Closed Bug 1583495 Opened 6 years ago Closed 6 years ago

Let UrlbarInput::focused use document.activeElement instead of the focused attribute

Categories

(Firefox :: Address Bar, task, P1)

task
Points:
1

Tracking

()

RESOLVED FIXED
Firefox 71
Iteration:
71.2 - Sept 16 - 29
Tracking Status
firefox71 --- fixed

People

(Reporter: dao, Assigned: dao)

References

Details

Attachments

(1 file)

To prevent needless flicker in new windows we set focused="true" on the urlbar by default: https://searchfox.org/mozilla-central/rev/153feabebc2d13bb4c29ef8adf104ec1ebd246ae/browser/base/content/browser.xhtml#864

Since the urlbar's focused property reflects this attribute, this could potentially confuse API users who want to know the actual focus state early during window opening.

We can address this by looking at document.activeElement instead. One thing to point out here is that activeElement points to the focused element even in unfocused window, where we'd remove the focused attribute. I think this is okay, maybe even preferable, but if this turns out to be a problem we could check the focused attribute in addition to document.activeElement.

API users who want to know the visible state instead of the actual focus state should check the attribute directly instead of using the focused property.

Pushed by dgottwald@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c737a0b6b1b3 Let UrlbarInput::focused use document.activeElement instead of the focused attribute. r=adw
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 71
Regressions: 1583993
Regressions: 1583708
Blocks: 1587800
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: