From: "T.V Raman" <raman@google.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 32348@debbugs.gnu.org
Subject: bug#32348: 27.0.50; EWW/SHR: Please add support for hiding DOM nodes with aria-hidden=true
Date: Wed, 15 Aug 2018 19:23:11 -0700 [thread overview]
Message-ID: <p91pnyjuk1c.fsf@google.com> (raw)
In-Reply-To: <87a7pnxk6r.fsf@gmail.com> (Noam Postavsky's message of "Wed, 15 Aug 2018 19:51:40 -0400")
Noam Postavsky <npostavs@gmail.com> writes:
Yes, please go ahead and push to Master.
Re the comment about including in eww's readable, it gets rid of the
zillion "share with" links on sites like the BBc.
> "T.V Raman" <raman@google.com> writes:
>
>> 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.
>
> Unless the "readable" command is actually giving bad results for
> real-world pages (is it?), I wouldn't start complicating the heuristic
> with more checks. It doesn't even check for display:none at the moment.
>
> I've updated my previous patch with some more documentation, so that
> someone who doesn't know anything about "aria-hidden" (e.g., me, before
> this thread) could have some chance of figuring out what it's good for.
> I'll push to master in a few days.
>
> From ead5619e844fced271866349fd34990641bf75c6 Mon Sep 17 00:00:00 2001
> From: Noam Postavsky <npostavs@gmail.com>
> Date: Tue, 7 Aug 2018 20:40:56 -0400
> Subject: [PATCH v2] 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.
> * doc/misc/eww.texi (Advanced): Document shr-discard-aria-hidden.
> * etc/NEWS: Announce it.
>
> fixup! shr: Allow skipping tags with aria-hidden (Bug#32348)
> ---
> doc/misc/eww.texi | 10 ++++++++++
> etc/NEWS | 3 +++
> lisp/net/shr.el | 12 +++++++++++-
> 3 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
> index 43adc2eda0..bd5aef6a8a 100644
> --- a/doc/misc/eww.texi
> +++ b/doc/misc/eww.texi
> @@ -262,6 +262,16 @@ Advanced
> variables @code{shr-color-visible-distance-min} and
> @code{shr-color-visible-luminance-min} to get a better contrast.
>
> +@vindex shr-discard-aria-hidden
> +@cindex aria-hidden
> + The HTML attribute @code{aria-hidden} is meant to tell screen
> +readers to ignore a tag's contents. You can customize the variable
> +@code{shr-discard-aria-hidden} to tell @code{shr} to ignore such tags.
> +This can be useful when using a screen reader on the output of
> +@code{shr} (e.g., on EWW buffer text). Or even when not using a
> +screen reader, since web authors often put this tag on non-essential
> +decorative content.
> +
> @cindex Desktop Support
> @cindex Saving Sessions
> In addition to maintaining the history at run-time, EWW will also
> diff --git a/etc/NEWS b/etc/NEWS
> index 60951dfac0..d2e111fd60 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -396,6 +396,9 @@ 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..0fbaf6f211 100644
> --- a/lisp/net/shr.el
> +++ b/lisp/net/shr.el
> @@ -68,6 +68,14 @@ shr-use-fonts
> :group 'shr
> :type 'boolean)
>
> +(defcustom shr-discard-aria-hidden nil
> + "If non-nil, don't render tags with `aria-hidden=\"true\"'.
> +This attribute is meant to tell screen readers to ignore the
> +tag's content."
> + :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 +517,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
--
next prev parent reply other threads:[~2018-08-16 2:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-02 15:25 bug#32348: 27.0.50; EWW/SHR: Please add support for hiding DOM nodes with aria-hidden=true T.V Raman
2018-08-08 0:45 ` Noam Postavsky
2018-08-08 14:27 ` T.V Raman
2018-08-15 23:51 ` Noam Postavsky
2018-08-16 2:23 ` T.V Raman [this message]
2018-08-16 11:25 ` Noam Postavsky
2018-08-16 14:09 ` T.V Raman
2018-08-16 13:21 ` Eli Zaretskii
2018-08-28 0:03 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=p91pnyjuk1c.fsf@google.com \
--to=raman@google.com \
--cc=32348@debbugs.gnu.org \
--cc=npostavs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).