Automatic update from web-platform-tests Implement HTMLElement accessKeyLabel This patch implements accessKeyLabel API, matching the HTMLElement specification [1]. This CL helps solve the problem where users find it hard to know which accesskey modifier to press. This also improves interoperability with Safari and Firefox, which have already shipped this API. FYI, This implementation is currently behind a runtime flag. Intent to Prototype: https://groups.google.com/a/chromium.org/g/blink-dev/c/uzx6kTcS3hY [1] https://html.spec.whatwg.org/multipage/interaction.html#dom-accesskeylabel Bug: 41119923 Change-Id: I5d8dff04189baea410656fed3096a0c876f417fb Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6865692 Reviewed-by: Jinho Bang <zino@chromium.org> Commit-Queue: YeongHan Kim <soosungp33@gmail.com> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1511307} -- wpt-commits: f16cc1de57a6550a968ddfaefc5625fa08538cef wpt-pr: 54704
27 lines
840 B
HTML
27 lines
840 B
HTML
<!DOCTYPE html>
|
|
<meta charset="UTF-8">
|
|
<title>accessKeyLabel attribute</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<body>
|
|
<script>
|
|
function createButtonWithAccessKey(accessKey) {
|
|
const button = document.createElement('button');
|
|
button.setAttribute('accesskey', accessKey);
|
|
return button;
|
|
}
|
|
|
|
// The modifiers are not the same across all browser vendors.
|
|
// Therefore, the test uses non empty.
|
|
test(() => {
|
|
const element = createButtonWithAccessKey('b');
|
|
assert_not_equals(element.accessKeyLabel, '');
|
|
}, 'Returns non empty string when accesskey is valid');
|
|
|
|
test(() => {
|
|
const element = createButtonWithAccessKey('s 0');
|
|
assert_equals(element.accessKeyLabel, '');
|
|
}, 'Returns empty string when accesskey is invalid');
|
|
</script>
|
|
</body>
|
|
</html> |