Closed Bug 1769481 Opened 2 years ago Closed 2 years ago

PanelMultiView is producing console warnings when it passes the "context" attribute's empty value to getElementById

Categories

(Firefox :: Toolbars and Customization, defect)

defect

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: aminomancer, Assigned: aminomancer)

Details

Attachments

(1 file)

This code is evaluating to this.document.getElementById("") in cases when we navigate with the keyboard on elements that don't have their own context attribute. This can be seen when tabbing through the static buttons in various panels. Passing an empty string to this method dispatches this console warning: Empty string passed to getElementById().

For example, in the History panel menu, there are 3 static buttons at the top: Recently closed tabs, Recently closed windows, and Clear recent history. Then there are a bunch of dynamically generated history entries. When we tab through the history entries there are no problems, since they each have their own context attribute, set by the method that creates the nodes from the history query. But the static items have no attribute.

In that case, focus.closest("[context]") scans up to the panel itself, which has an empty context attribute that's intended to keep us from showing the toolbar context menu. So that's how we're getting an empty string to pass. To fix it, we just need to check that the context value is truthy, not just the contextNode.

Assignee: nobody → shmediaproductions
Status: NEW → ASSIGNED
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/7bdabd03250f
Fix PanelMultiView console warnings. r=Gijs
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: