-
-
Notifications
You must be signed in to change notification settings - Fork 79.2k
First pass at submenu support #41967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v6-dev
Are you sure you want to change the base?
Conversation
| const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_MOUSEENTER_DATA_API = `mouseenter${EVENT_KEY}${DATA_API_KEY}` |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
To fix the problem, remove the unused constant so that the code only defines event constants that are actually used. This eliminates the dead variable and any confusion about whether a mouseenter data-API event is supported.
Concretely, in js/src/dropdown.js, delete the line that defines EVENT_MOUSEENTER_DATA_API. Leave the other constants (EVENT_HIDE, EVENT_HIDDEN, EVENT_SHOW, EVENT_SHOWN, EVENT_CLICK_DATA_API, EVENT_KEYDOWN_DATA_API, EVENT_KEYUP_DATA_API, EVENT_MOUSELEAVE_DATA_API) untouched. No new imports, methods, or additional definitions are needed.
| @@ -66,7 +66,6 @@ | ||
| const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_MOUSEENTER_DATA_API = `mouseenter${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_MOUSELEAVE_DATA_API = `mouseleave${EVENT_KEY}${DATA_API_KEY}` | ||
|
|
||
| const CLASS_NAME_SHOW = 'show' |
| const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_MOUSEENTER_DATA_API = `mouseenter${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_MOUSELEAVE_DATA_API = `mouseleave${EVENT_KEY}${DATA_API_KEY}` |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 2 days ago
In general, the way to fix an unused-constant problem is either to remove the unused declaration or to start using it where it was intended. Since we have no evidence of a missing mouseleave handler elsewhere in the shown snippet, the safest fix that does not alter existing behavior is to remove the unused constant.
Concretely, in js/src/dropdown.js we should delete the line that defines EVENT_MOUSELEAVE_DATA_API. All surrounding constants (EVENT_HIDE, EVENT_HIDDEN, EVENT_SHOW, EVENT_SHOWN, EVENT_CLICK_DATA_API, EVENT_KEYDOWN_DATA_API, EVENT_KEYUP_DATA_API, EVENT_MOUSEENTER_DATA_API) remain unchanged. No additional methods, imports, or definitions are required; we are simply removing dead code.
| @@ -67,7 +67,6 @@ | ||
| const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_MOUSEENTER_DATA_API = `mouseenter${EVENT_KEY}${DATA_API_KEY}` | ||
| const EVENT_MOUSELEAVE_DATA_API = `mouseleave${EVENT_KEY}${DATA_API_KEY}` | ||
|
|
||
| const CLASS_NAME_SHOW = 'show' | ||
| const CLASS_NAME_MOBILE = 'dropdown-menu-mobile' |
Adds submenu support to dropdowns. Needs a big cleanup.