Open Bug 1986568 Opened 1 year ago Updated 5 months ago

moz-label accesskeys are not updated when accesskey and text change together

Categories

(Firefox :: Settings UI, defect, P3)

defect

Tracking

()

People

(Reporter: mstriemer, Unassigned)

References

Details

(Whiteboard: [recomp])

Before bug 1976006 the text labels weren't being cleaned up properly, the changes there fixed the text labels, but if the accesskey also changes then the accesskey is not updated.

I believe this is happening:

  • Fluent updates the moz-checkbox's label and accesskey attributes
  • moz-checkbox sets the shownaccesskey attribute on moz-label
  • moz-label's attributeChangedCallback fires synchronously
  • moz-label pauses its mutation observer since it is about to cause a mutation
  • The displayed accesskey is updated, however the textContent has not yet changed
  • moz-label queues a microtask to resume mutation listeners
  • moz-checkbox sets the textContent of the moz-label
  • moz-label starts observing mutations again

This is the sort of thing that LitElement/ReactiveElement will paper over for us, but since we're inheriting from HTMLLabelElement here, we don't get that help.

We'll likely want to do something similar where we queue updates when any of the conditions change. It looks like Lit accomplishes this by awaiting the previous update. Rather than pausing the MutationObserver we may want to cache the last string we formatted the accesskey on, and ignore the event if the textContent is unchanged

Severity: -- → S3
Priority: -- → P3

We are working around this issue in MozBaseInputElement by setting the label using .textContent Searchfox

Anyone that uses moz-label directly would run into these issues though.

moz-button uses moz-label and runs into the similar issue when l10nId that provides both label and accesskey updates dynamically (see bug 2022326)

See Also: → 2022326
You need to log in before you can comment on or make changes to this bug.