mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
[Editor] Improve a11y for newly added element (#15109)
- In the annotationEditorLayer, reorder the editors in the DOM according the position of the elements on the screen; - add an aria-owns attribute on the "nearest" element in the text layer which points to the added editor.
This commit is contained in:
parent
ad15532235
commit
624b26e1de
15 changed files with 467 additions and 96 deletions
|
@ -15,7 +15,6 @@
|
|||
|
||||
import {
|
||||
backtrackBeforeAllVisibleElements,
|
||||
binarySearchFirstItem,
|
||||
getPageSizeInches,
|
||||
getVisibleElements,
|
||||
isPortraitOrientation,
|
||||
|
@ -25,39 +24,6 @@ import {
|
|||
} from "../../web/ui_utils.js";
|
||||
|
||||
describe("ui_utils", function () {
|
||||
describe("binary search", function () {
|
||||
function isTrue(boolean) {
|
||||
return boolean;
|
||||
}
|
||||
function isGreater3(number) {
|
||||
return number > 3;
|
||||
}
|
||||
|
||||
it("empty array", function () {
|
||||
expect(binarySearchFirstItem([], isTrue)).toEqual(0);
|
||||
});
|
||||
it("single boolean entry", function () {
|
||||
expect(binarySearchFirstItem([false], isTrue)).toEqual(1);
|
||||
expect(binarySearchFirstItem([true], isTrue)).toEqual(0);
|
||||
});
|
||||
it("three boolean entries", function () {
|
||||
expect(binarySearchFirstItem([true, true, true], isTrue)).toEqual(0);
|
||||
expect(binarySearchFirstItem([false, true, true], isTrue)).toEqual(1);
|
||||
expect(binarySearchFirstItem([false, false, true], isTrue)).toEqual(2);
|
||||
expect(binarySearchFirstItem([false, false, false], isTrue)).toEqual(3);
|
||||
});
|
||||
it("three numeric entries", function () {
|
||||
expect(binarySearchFirstItem([0, 1, 2], isGreater3)).toEqual(3);
|
||||
expect(binarySearchFirstItem([2, 3, 4], isGreater3)).toEqual(2);
|
||||
expect(binarySearchFirstItem([4, 5, 6], isGreater3)).toEqual(0);
|
||||
});
|
||||
it("three numeric entries and a start index", function () {
|
||||
expect(binarySearchFirstItem([0, 1, 2, 3, 4], isGreater3, 2)).toEqual(4);
|
||||
expect(binarySearchFirstItem([2, 3, 4], isGreater3, 2)).toEqual(2);
|
||||
expect(binarySearchFirstItem([4, 5, 6], isGreater3, 1)).toEqual(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isValidRotation", function () {
|
||||
it("should reject non-integer angles", function () {
|
||||
expect(isValidRotation()).toEqual(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue