mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #18889 from calixteman/rm_useless_aria_has_popup
Don't add attribute 'aria-haspopup' when no popup is rendered for an annotation
This commit is contained in:
commit
e28dd8e824
2 changed files with 36 additions and 12 deletions
|
@ -285,10 +285,6 @@ class AnnotationElement {
|
|||
// use of the z-index.
|
||||
style.zIndex = this.parent.zIndex++;
|
||||
|
||||
if (data.popupRef) {
|
||||
container.setAttribute("aria-haspopup", "dialog");
|
||||
}
|
||||
|
||||
if (data.alternativeText) {
|
||||
container.title = data.alternativeText;
|
||||
}
|
||||
|
@ -624,8 +620,7 @@ class AnnotationElement {
|
|||
* @memberof AnnotationElement
|
||||
*/
|
||||
_createPopup() {
|
||||
const { container, data } = this;
|
||||
container.setAttribute("aria-haspopup", "dialog");
|
||||
const { data } = this;
|
||||
|
||||
const popup = (this.#popupElement = new PopupAnnotationElement({
|
||||
data: {
|
||||
|
@ -2091,6 +2086,7 @@ class PopupAnnotationElement extends AnnotationElement {
|
|||
const elementIds = [];
|
||||
for (const element of this.elements) {
|
||||
element.popup = popup;
|
||||
element.container.ariaHasPopup = "dialog";
|
||||
elementIds.push(element.data.id);
|
||||
element.addHighlightArea();
|
||||
}
|
||||
|
@ -2853,15 +2849,13 @@ class InkAnnotationElement extends AnnotationElement {
|
|||
polyline.setAttribute("stroke", "transparent");
|
||||
polyline.setAttribute("fill", "transparent");
|
||||
|
||||
// Create the popup ourselves so that we can bind it to the polyline
|
||||
// instead of to the entire container (which is the default).
|
||||
if (!popupRef && this.hasPopupData) {
|
||||
this._createPopup();
|
||||
}
|
||||
|
||||
svg.append(polyline);
|
||||
}
|
||||
|
||||
if (!popupRef && this.hasPopupData) {
|
||||
this._createPopup();
|
||||
}
|
||||
|
||||
this.container.append(svg);
|
||||
this._editOnDoubleClick();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue