mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Annotation & XFA: Scale the font size in choicelist using zoom factor (bug 1715996)
- this is an accessibility issue which could be painful for some people with visual disabilities.
This commit is contained in:
parent
52ef63f1fe
commit
71a100a4d0
4 changed files with 21 additions and 0 deletions
|
@ -1138,11 +1138,19 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : undefined,
|
||||
});
|
||||
|
||||
let { fontSize } = this.data.defaultAppearanceData;
|
||||
if (!fontSize) {
|
||||
fontSize = 9;
|
||||
}
|
||||
const fontSizeStyle = `calc(${fontSize}px * var(--zoom-factor))`;
|
||||
|
||||
const selectElement = document.createElement("select");
|
||||
selectElement.disabled = this.data.readOnly;
|
||||
selectElement.name = this.data.fieldName;
|
||||
selectElement.setAttribute("id", id);
|
||||
|
||||
selectElement.style.fontSize = `${fontSize}px`;
|
||||
|
||||
if (!this.data.combo) {
|
||||
// List boxes have a size and (optionally) multiple selection.
|
||||
selectElement.size = this.data.options.length;
|
||||
|
@ -1156,6 +1164,9 @@ class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement {
|
|||
const optionElement = document.createElement("option");
|
||||
optionElement.textContent = option.displayValue;
|
||||
optionElement.value = option.exportValue;
|
||||
if (this.data.combo) {
|
||||
optionElement.style.fontSize = fontSizeStyle;
|
||||
}
|
||||
if (this.data.fieldValue.includes(option.exportValue)) {
|
||||
optionElement.setAttribute("selected", true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue