-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set minimum target size of 24px for appearance:base-select
According to accessibility guidelines, we must ensure that all of the pointer targets in appearance:base-select must be at least 24x24 CSS pixels. openui/open-ui#1026 Bug: 1511354 Change-Id: Iba814399e4061f7ce36c24296aef37a540444612 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5503502 Commit-Queue: Joey Arhar <jarhar@chromium.org> Reviewed-by: David Baron <dbaron@chromium.org> Cr-Commit-Position: refs/heads/main@{#1301595}
- Loading branch information
1 parent
6bdb665
commit f23e47a
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...he-select-element/stylable-select/select-accessibility-minimum-target-size.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:jarhar@chromium.org"> | ||
<link rel=help href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html"> | ||
<link rel=help href="https://github.com/openui/open-ui/issues/1026"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
|
||
<select style="appearance:base-select"> | ||
<option></option> | ||
</select> | ||
|
||
<script> | ||
const option = document.querySelector('option'); | ||
for (const text of ['', 'i']) { | ||
for (const writingMode of ['horizontal-tb', 'vertical-lr', 'vertical-rl']) { | ||
promise_test(async () => { | ||
document.documentElement.style.writingMode = writingMode; | ||
option.textContent = text; | ||
await new Promise(requestAnimationFrame); | ||
|
||
const select = document.querySelector('select'); | ||
const buttonRect = select.getBoundingClientRect(); | ||
assert_greater_than_equal(buttonRect.width, 24, | ||
'Button width must be at least 24 pixels.'); | ||
assert_greater_than_equal(buttonRect.height, 24, | ||
'Button height must be at least 24 pixels.'); | ||
|
||
await test_driver.bless(); | ||
select.showPicker(); | ||
const optionRect = document.querySelector('option').getBoundingClientRect(); | ||
assert_greater_than_equal(optionRect.width, 24, | ||
'Option width must be at least 24 pixels.'); | ||
assert_greater_than_equal(optionRect.height, 24, | ||
'Option height must be at least 24 pixels.'); | ||
}, `${writingMode} "${text}": Select with appearance:base-select should have targets for pointer inputs be at least 24x24 CSS pixels.`); | ||
} | ||
} | ||
</script> |