mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 17:25:36 +00:00
Bug 1606018 - Make sure edit context menu also appears on inputs inside shadow trees. r=bgrins
Differential Revision: https://phabricator.services.mozilla.com/D61847 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
df16bc9e25
commit
f6a013abd2
@ -96,12 +96,12 @@ window.addEventListener(
|
||||
window.addEventListener("contextmenu", e => {
|
||||
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
let needsContextMenu =
|
||||
e.target.ownerDocument == document &&
|
||||
e.composedTarget.ownerDocument == document &&
|
||||
!e.defaultPrevented &&
|
||||
e.target.parentNode.nodeName != "moz-input-box" &&
|
||||
((["textarea", "input"].includes(e.target.localName) &&
|
||||
e.target.namespaceURI == HTML_NS) ||
|
||||
e.target.closest("search-textbox"));
|
||||
e.composedTarget.parentNode.nodeName != "moz-input-box" &&
|
||||
((["textarea", "input"].includes(e.composedTarget.localName) &&
|
||||
e.composedTarget.namespaceURI == HTML_NS) ||
|
||||
e.composedTarget.closest("search-textbox"));
|
||||
|
||||
if (!needsContextMenu) {
|
||||
return;
|
||||
|
@ -2,7 +2,15 @@
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css"?>
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<script>
|
||||
customElements.define("shadow-input", class extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.attachShadow({ mode: "open" });
|
||||
this.shadowRoot.appendChild(document.createElement("input"));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<!-- Copied from toolkit/content/editMenuCommands.inc.xul -->
|
||||
<script type="application/javascript" src="chrome://global/content/editMenuOverlay.js"/>
|
||||
@ -32,6 +40,7 @@
|
||||
<html:textarea />
|
||||
<html:input />
|
||||
<search-textbox />
|
||||
<html:shadow-input />
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
@ -23,6 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1513343
|
||||
win.document.querySelector("textarea"),
|
||||
win.document.querySelector("input"),
|
||||
win.document.querySelector("search-textbox"),
|
||||
win.document.querySelector("shadow-input").shadowRoot.querySelector("input"),
|
||||
];
|
||||
for (const element of elements) {
|
||||
await testElement(element, win);
|
||||
|
Loading…
Reference in New Issue
Block a user