all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: "T.V Raman" <raman@google.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: Tue, 07 Aug 2018 20:45:44 -0400	[thread overview]
Message-ID: <874lg5y9c7.fsf@gmail.com> (raw)
In-Reply-To: <p91d0v0okog.fsf@retriever.mtv.corp.google.com> (T. V. Raman's message of "Thu, 02 Aug 2018 08:25:03 -0700")

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 1973 bytes --]

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


  reply	other threads:[~2018-08-08  0:45 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 [this message]
2018-08-08 14:27   ` T.V Raman
2018-08-15 23:51     ` Noam Postavsky
2018-08-16  2:23       ` T.V Raman
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874lg5y9c7.fsf@gmail.com \
    --to=npostavs@gmail.com \
    --cc=32348@debbugs.gnu.org \
    --cc=raman@google.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.