[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32348: 27.0.50; EWW/SHR: Please add support for hiding DOM nodes wit
From: |
T.V Raman |
Subject: |
bug#32348: 27.0.50; EWW/SHR: Please add support for hiding DOM nodes with aria-hidden=true |
Date: |
Wed, 8 Aug 2018 07:27:25 -0700 |
Nice, this is good enough for me. Another place to leverage
aria-hidden might be in EWW's "readable" command. Note that in
general those nodes are shown on screen but are useless for the most
part -- and usually inoperable under EWW. As an example, articles from
the BBC for instance use these nodes to add buttons for "share via
messenger" etc.
Noam Postavsky writes:
> tags 32348 + patch
> quit
>
> "T.V Raman" <raman@google.com> writes:
>
> > aria-hidden as specified in the W3C/WAI ARIA 1.1 specification lets Web
> > sites mark DOM Nodes with aria-hidden=true -- the idea being that nodes
> > that contain content relevant to script -- but not for direct user
> > consumption can then be omitted by accessibility tools such as
> > screenreaders. Please add support for hiding such nodes -- either by
> > default, or via a user customization.
>
> As far as I can tell, hiding by default would not make sense, since such
> nodes are intended to be hidden only from screen-readers, but visible
> otherwise. The following patch to add an option seems to work:
>
>
> ----------------------------------------------------------------------
> >From b56b24a1a40fdce7746ff0f81570b29c83309c12 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs@gmail.com>
> Date: Tue, 7 Aug 2018 20:40:56 -0400
> Subject: [PATCH] Optionally skip rendering of tags with aria-hidden
> (Bug#32348)
>
> * lisp/net/shr.el (shr-discard-aria-hidden): New option.
> (shr-descend): Suppress aria-hidden=true tags if it's set.
> * etc/NEWS: Announce shr-discard-aria-hidden.
> ---
> etc/NEWS | 2 ++
> lisp/net/shr.el | 10 +++++++++-
> 2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/etc/NEWS b/etc/NEWS
> index 2825bb9f59..068c48cabc 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -363,6 +363,8 @@ and its value has been changed to Duck Duck Go.
> 'shr-selected-link' face to give the user feedback that the command
> has been executed.
>
> +*** New option 'shr-discard-aria-hidden'.
> +
> ** Htmlfontify
>
> *** The functions 'hfy-color', 'hfy-color-vals' and
> diff --git a/lisp/net/shr.el b/lisp/net/shr.el
> index edea7cb297..2599c3c727 100644
> --- a/lisp/net/shr.el
> +++ b/lisp/net/shr.el
> @@ -68,6 +68,12 @@ shr-use-fonts
> :group 'shr
> :type 'boolean)
>
> +(defcustom shr-discard-aria-hidden nil
> + "If non-nil, don't render tags with `aria-hidden=true' attribute."
> + :version "27.1"
> + :group 'shr
> + :type 'boolean)
> +
> (defcustom shr-use-colors t
> "If non-nil, respect color specifications in the HTML."
> :version "26.1"
> @@ -509,7 +515,9 @@ shr-descend
> shr-stylesheet))
> (setq style nil)))
> ;; If we have a display:none, then just ignore this part of the DOM.
> - (unless (equal (cdr (assq 'display shr-stylesheet)) "none")
> + (unless (or (equal (cdr (assq 'display shr-stylesheet)) "none")
> + (and shr-discard-aria-hidden
> + (equal (dom-attr dom 'aria-hidden) "true")))
> ;; We don't use shr-indirect-call here, since shr-descend is
> ;; the central bit of shr.el, and should be as fast as
> ;; possible. Having one more level of indirection with its
> --
> 2.11.0
>
--
Id: kg:/m/0285kf1
--
Id: kg:/m/0285kf1