w3c / webextensions

Charter and administrivia for the WebExtensions Community Group (WECG)
Other
605 stars 56 forks source link

Undetectable widgets, to avoid conflicts (modals, tooltips, notifications, …) #656

Closed fregante closed 4 months ago

fregante commented 4 months ago

Some extensions inject widgets and other hidden DOM content that is at risk of being inadvertently removed by the host website. Some examples:

I think we'd benefit from a way to inject content without risking (style) conflicts, removal by the host, race conditions, etc.

Proposal

Offer a shadow/child/detached/isolated document context that extensions can interact with without being detected. This document would be visually overlaid on the page, if any elements are visible, without causing any layout shifts.

const modal = document.createElement('dialog');
modal.append(document.createElement('iframe'))
browser.dom.attach(modal, {style: 'isolated'});
modal.showModal();

const style = document.createElement('style');
ReactDom.render(<CssVariablesUpdatedViaIframeWidgetOrSomething/>, style);
browser.dom.attach(style);

I haven't put much thought into the actual API that would enable this, as it would probably have to follow the browser limits/implementation.

Prior art

Other more specific requests

xeenon commented 4 months ago

Similar to #235.

Rob--W commented 4 months ago

Closing as duplicate of #235. The generic feature request has come up many times before, but there won't be any progress until there is a specific API proposal that can feasibly be implemented by browsers. See the meeting notes of today's meeting (pending review in #660) for more words on this.

fregante commented 4 months ago

Thank you