Addon to change tab title

Noob here.

Goal: I tab onto an web page element. At each tabbing, I want that element name to be in the tab title (aka Firefox Window Title). Eg. normally tab name is ‘Latest Add-ons/Add-on Support topics - Mozilla Discourse — Mozilla Firefox’. I want 'Latest Add-ons/Add-on Support topics - Mozilla Discourse [[element name]] — Mozilla Firefox.

To me it seems I should have a content script somewhere:
document.title = document.title + ’ [[’ + element name + ‘]].
But this might not work with all web pages, as ‘Content scripts cannot see JavaScript variables defined by page scripts’. But as a first step for newbie, how do I access ‘element name’ and where do I put the "document.title = document.title + ’ [[’ + element name + ']]".

Please, and thanks!
br,
Kaido