(In reply to Emilio Cobos Álvarez (:emilio) from comment #1) > So this is IMO more of a feature rather than a bug, but... > > The focus comes from [here](https://searchfox.org/mozilla-central/rev/b7b156e53643f0237f3e98a76e5fc7fa9e3b4e71/toolkit/components/prompts/src/CommonDialog.jsm#313). > > Since the dialog has never had any focused element, then programmatic focus shows a ring. There's some discussion in [this CSSWG issue](https://github.com/w3c/csswg-drafts/issues/5885). > > So for most pages that open dialogs this is not an issue because the dialog is opened via click, which focuses the button etc, and then we don't show rings because the button didn't use to match `:focus-visible`... I'm confused - what kind of "dialog" are you referring to here? Are you suggesting that this problem doesn't happen if a website calls `alert()` in response to a mouse click (and if so, why does that make a difference here - we still load commonDialog...)? Or are you talking about `html:dialog` use inside websites (which AIUI is still preffed off in gecko on release) ? Does the presence or absence of a focused element in the webpage before the `alert()` shows up make a difference to the `:focus-visible` matching in the `alert()` dialog document, even though they're in different processes as well as different frame trees? Or something else?
Bug 1699259 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
(In reply to Emilio Cobos Álvarez (:emilio) from comment #1) > So this is IMO more of a feature rather than a bug, but... > > The focus comes from [here](https://searchfox.org/mozilla-central/rev/b7b156e53643f0237f3e98a76e5fc7fa9e3b4e71/toolkit/components/prompts/src/CommonDialog.jsm#313). > > Since the dialog has never had any focused element, then programmatic focus shows a ring. There's some discussion in [this CSSWG issue](https://github.com/w3c/csswg-drafts/issues/5885). > > So for most pages that open dialogs this is not an issue because the dialog is opened via click, which focuses the button etc, and then we don't show rings because the button didn't use to match `:focus-visible`... I'm confused - what kind of "dialog" are you referring to here? Are you suggesting that this problem doesn't happen if a website calls `alert()` in response to a mouse click (and if so, why does that make a difference here - we still load commonDialog...)? Or are you talking about `html:dialog` use inside websites (which AIUI is still preffed off in gecko on release) ? Does the presence or absence of a focused element in the webpage before the `alert()` shows up make a difference to the `:focus-visible` matching in the `alert()` dialog document, even though they're in different processes as well as different browsing context trees? Or something else?
(In reply to Emilio Cobos Álvarez (:emilio) from comment #1) > So this is IMO more of a feature rather than a bug, but... > > The focus comes from [here](https://searchfox.org/mozilla-central/rev/b7b156e53643f0237f3e98a76e5fc7fa9e3b4e71/toolkit/components/prompts/src/CommonDialog.jsm#313). > > Since the dialog has never had any focused element, then programmatic focus shows a ring. There's some discussion in [this CSSWG issue](https://github.com/w3c/csswg-drafts/issues/5885). > > So for most pages that open dialogs this is not an issue because the dialog is opened via click, which focuses the button etc, and then we don't show rings because the button didn't use to match `:focus-visible`... I'm confused - what kind of "dialog" are you referring to here? Are you suggesting that this problem doesn't happen if a website calls `alert()` in response to a mouse click (and if so, why does that make a difference here - we still load commonDialog...)? Or are you talking about `html:dialog` use inside websites (which AIUI is still preffed off in gecko on release) ? Does the presence or absence of a focused element in the webpage before the `alert()` shows up make a difference to the `:focus-visible` matching in the `alert()` dialog document, even though they're in different processes as well as different browsing context trees (ie the alert dialog is not a subframe of the web content document)? Or something else?