Closed Bug 1940057 Opened 1 year ago Closed 1 year ago

Replase `Services.focus.setFocus` with `Element#focus` in `MarkupContainer#focus`

Categories

(DevTools :: Inspector, task)

task

Tracking

(firefox136 fixed)

RESOLVED FIXED
136 Branch
Tracking Status
firefox136 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/94c62970ba2f9c40efd5a4f83a538595425820d9/devtools/client/inspector/markup/views/markup-container.js#827-834

// When focus is coming from a mouse event:
// - prevent :focus-visible to be applied to the element
// - don't scroll element into view, as this could change the horizontal scroll,
//   and the element is already visible since the user clicked on it.
Services.focus.setFocus(
  focusable,
  Services.focus.FLAG_NOSHOWRING | Services.focus.FLAG_NOSCROLL
);

We were using Services.focus.setFocus so we wouldn't scroll and avoid setting the focus visible style, but those are available in regular Element#focus (see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#preventscroll)
Let's use those directly since this is a bit more straightforward

The option we were using are available natively, so let's use that.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/410b04cae735 [devtools] Replace Services.focus.setFocus with Element#focus in MarkupContainer#focus. r=ochameau,devtools-reviewers.
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 136 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: