mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Annotation & XFA: Add focus outlines on different fields (bug 1723615, bug 1718528)
- set a default tabindex to be sure they'll be taken into account in the TAB cycle (https://bugzilla.mozilla.org/show_bug.cgi?id=1723615). - show default outline when fields are focused (it was an a11y bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1718528).
This commit is contained in:
parent
4ad65c8b9c
commit
fef939d347
4 changed files with 39 additions and 4 deletions
|
@ -33,6 +33,8 @@ import {
|
|||
import { AnnotationStorage } from "./annotation_storage.js";
|
||||
import { ColorConverters } from "../shared/scripting_utils.js";
|
||||
|
||||
const DEFAULT_TAB_INDEX = 1000;
|
||||
|
||||
/**
|
||||
* @typedef {Object} AnnotationElementParameters
|
||||
* @property {Object} data
|
||||
|
@ -722,6 +724,7 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
element.type = "text";
|
||||
element.setAttribute("value", textContent);
|
||||
}
|
||||
element.tabIndex = DEFAULT_TAB_INDEX;
|
||||
|
||||
elementData.userValue = textContent;
|
||||
element.setAttribute("id", id);
|
||||
|
@ -978,6 +981,7 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
element.setAttribute("checked", true);
|
||||
}
|
||||
element.setAttribute("id", id);
|
||||
element.tabIndex = DEFAULT_TAB_INDEX;
|
||||
|
||||
element.addEventListener("change", function (event) {
|
||||
const name = event.target.name;
|
||||
|
@ -1052,6 +1056,7 @@ class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
element.setAttribute("checked", true);
|
||||
}
|
||||
element.setAttribute("id", id);
|
||||
element.tabIndex = DEFAULT_TAB_INDEX;
|
||||
|
||||
element.addEventListener("change", function (event) {
|
||||
const { target } = event;
|
||||
|
@ -1148,6 +1153,7 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
selectElement.disabled = this.data.readOnly;
|
||||
selectElement.name = this.data.fieldName;
|
||||
selectElement.setAttribute("id", id);
|
||||
selectElement.tabIndex = DEFAULT_TAB_INDEX;
|
||||
|
||||
selectElement.style.fontSize = `${fontSize}px`;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue