diff options
| -rw-r--r-- | doc/misc/eww.texi | 10 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/net/shr.el | 11 |
3 files changed, 25 insertions, 1 deletions
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi index 43adc2eda0f..aa17eee9d94 100644 --- a/doc/misc/eww.texi +++ b/doc/misc/eww.texi | |||
| @@ -262,6 +262,16 @@ contrast. If that is still too low for you, you can customize the | |||
| 262 | variables @code{shr-color-visible-distance-min} and | 262 | variables @code{shr-color-visible-distance-min} and |
| 263 | @code{shr-color-visible-luminance-min} to get a better contrast. | 263 | @code{shr-color-visible-luminance-min} to get a better contrast. |
| 264 | 264 | ||
| 265 | @vindex shr-discard-aria-hidden | ||
| 266 | @cindex @code{aria-hidden}, HTML attribute | ||
| 267 | The HTML attribute @code{aria-hidden} is meant to tell screen | ||
| 268 | readers to ignore a tag's contents. You can customize the variable | ||
| 269 | @code{shr-discard-aria-hidden} to tell @code{shr} to ignore such tags. | ||
| 270 | This can be useful when using a screen reader on the output of | ||
| 271 | @code{shr} (e.g., on EWW buffer text). It can be useful even when not | ||
| 272 | using a screen reader, since web authors often put this attribute on | ||
| 273 | non-essential decorative elements. | ||
| 274 | |||
| 265 | @cindex Desktop Support | 275 | @cindex Desktop Support |
| 266 | @cindex Saving Sessions | 276 | @cindex Saving Sessions |
| 267 | In addition to maintaining the history at run-time, EWW will also | 277 | In addition to maintaining the history at run-time, EWW will also |
| @@ -405,6 +405,11 @@ and its value has been changed to Duck Duck Go. | |||
| 405 | 'shr-selected-link' face to give the user feedback that the command | 405 | 'shr-selected-link' face to give the user feedback that the command |
| 406 | has been executed. | 406 | has been executed. |
| 407 | 407 | ||
| 408 | +++ | ||
| 409 | *** New option 'shr-discard-aria-hidden'. | ||
| 410 | If set, shr will not render tags with attribute 'aria-hidden="true"'. | ||
| 411 | This attribute is meant to tell screen readers to ignore a tag. | ||
| 412 | |||
| 408 | ** Htmlfontify | 413 | ** Htmlfontify |
| 409 | 414 | ||
| 410 | *** The functions 'hfy-color', 'hfy-color-vals' and | 415 | *** The functions 'hfy-color', 'hfy-color-vals' and |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index edea7cb297c..bc86fe5a383 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -68,6 +68,13 @@ fit these criteria." | |||
| 68 | :group 'shr | 68 | :group 'shr |
| 69 | :type 'boolean) | 69 | :type 'boolean) |
| 70 | 70 | ||
| 71 | (defcustom shr-discard-aria-hidden nil | ||
| 72 | "If non-nil, don't render tags with `aria-hidden=\"true\"'. | ||
| 73 | This attribute is meant to tell screen readers to ignore a tag." | ||
| 74 | :version "27.1" | ||
| 75 | :group 'shr | ||
| 76 | :type 'boolean) | ||
| 77 | |||
| 71 | (defcustom shr-use-colors t | 78 | (defcustom shr-use-colors t |
| 72 | "If non-nil, respect color specifications in the HTML." | 79 | "If non-nil, respect color specifications in the HTML." |
| 73 | :version "26.1" | 80 | :version "26.1" |
| @@ -509,7 +516,9 @@ size, and full-buffer size." | |||
| 509 | shr-stylesheet)) | 516 | shr-stylesheet)) |
| 510 | (setq style nil))) | 517 | (setq style nil))) |
| 511 | ;; If we have a display:none, then just ignore this part of the DOM. | 518 | ;; If we have a display:none, then just ignore this part of the DOM. |
| 512 | (unless (equal (cdr (assq 'display shr-stylesheet)) "none") | 519 | (unless (or (equal (cdr (assq 'display shr-stylesheet)) "none") |
| 520 | (and shr-discard-aria-hidden | ||
| 521 | (equal (dom-attr dom 'aria-hidden) "true"))) | ||
| 513 | ;; We don't use shr-indirect-call here, since shr-descend is | 522 | ;; We don't use shr-indirect-call here, since shr-descend is |
| 514 | ;; the central bit of shr.el, and should be as fast as | 523 | ;; the central bit of shr.el, and should be as fast as |
| 515 | ;; possible. Having one more level of indirection with its | 524 | ;; possible. Having one more level of indirection with its |