GNU bug report logs -
#32348
27.0.50; EWW/SHR: Please add support for hiding DOM nodes with aria-hidden=true
Previous Next
Reported by: "T.V Raman" <raman <at> google.com>
Date: Thu, 2 Aug 2018 15:27:01 UTC
Severity: wishlist
Tags: fixed, patch
Found in version 27.0.50
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
tags 32348 + patch
quit
"T.V Raman" <raman <at> 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:
[0001-Optionally-skip-rendering-of-tags-with-aria-hidden-B.patch (text/x-diff, inline)]
From b56b24a1a40fdce7746ff0f81570b29c83309c12 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> 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
This bug report was last modified 6 years and 263 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.