script: Add support for the accesskey attribute (#43031)

This change adds support for the `accesskey` HTML attribute the
corresponding behavior defined by the HTML standard. In addition to a
new map holding a mapping between access key characters and a rooted
reference to elements that use them, it adds a struct to represent the
"Command" concept from the specification [^1], which seems to be used
for `accesskey`. Not all command facets are implemented as some seem to
be unused in the specification.

[^1]:
https://html.spec.whatwg.org/multipage/interactive-elements.html#commands

Testing: This causes most access key tests to start passing. One test
now
only partially completes, because of a bug in the way that we fire
synthetic
mouse events.
Fixes: This is part of #25001.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2026-03-06 15:22:54 +01:00
committed by GitHub
parent 17dcf840ef
commit a48bef2316
21 changed files with 428 additions and 13718 deletions

View File

@@ -155,7 +155,7 @@ impl HTMLOptionElement {
}
/// <https://html.spec.whatwg.org/multipage/#option-element-nearest-ancestor-select>
fn nearest_ancestor_select(&self) -> Option<DomRoot<HTMLSelectElement>> {
pub(crate) fn nearest_ancestor_select(&self) -> Option<DomRoot<HTMLSelectElement>> {
// Step 1. Let ancestorOptgroup be null.
// NOTE: We only care whether the value is non-null, so a boolean is enough
let mut did_see_ancestor_optgroup = false;