From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs 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 Message-ID: <874lg5y9c7.fsf@gmail.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1533689049 22275 195.159.176.226 (8 Aug 2018 00:44:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 8 Aug 2018 00:44:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 32348@debbugs.gnu.org To: "T.V Raman" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 08 02:44:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnCa3-0005fB-VX for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Aug 2018 02:44:04 +0200 Original-Received: from localhost ([::1]:41361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnCcA-0001iM-E3 for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Aug 2018 20:46:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnCc3-0001hm-Ia for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2018 20:46:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnCby-0008Pv-Lm for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2018 20:46:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39030) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnCby-0008Pj-FN for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2018 20:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fnCby-0002Z9-21 for bug-gnu-emacs@gnu.org; Tue, 07 Aug 2018 20:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Aug 2018 00:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32348 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32348-submit@debbugs.gnu.org id=B32348.15336891559846 (code B ref 32348); Wed, 08 Aug 2018 00:46:02 +0000 Original-Received: (at 32348) by debbugs.gnu.org; 8 Aug 2018 00:45:55 +0000 Original-Received: from localhost ([127.0.0.1]:44048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnCbr-0002Yf-EX for submit@debbugs.gnu.org; Tue, 07 Aug 2018 20:45:55 -0400 Original-Received: from mail-it0-f44.google.com ([209.85.214.44]:35333) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnCbo-0002YM-Rv; Tue, 07 Aug 2018 20:45:53 -0400 Original-Received: by mail-it0-f44.google.com with SMTP id 139-v6so1411635itf.0; Tue, 07 Aug 2018 17:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Jj5AMH+h+oe47dY+EAZY03JsOeanI4Ua7kuFCimldDE=; b=fy2NPeujMCZ9+OFN5jJluoJGx7nJ224oT9hnQSrCeN+MlzBO4kR2BHyU5j1d5ptw46 nui0TK4784TIPdYdJwFOOtZcUw8tzuM9n6CUKAAPaKAooGfD1BuI0IOCAxv5ltq7GsRh RL0sBDQOY2S7luQ9H1reMLJuPMMbwyOW/C6GLTtdMkgRJb+SgdL4VeEDbbkzUVAgcIWK rQnQiYcvjpzB8fAO093+kuzt2mEPOR/+B2cnQ/WMi7wFVMo8Exce0OHXnSRbc25xwoW/ sVMZ+DZyBy488f8xCyW8sGg5taUosrreuE/UgjGWEExIghn15MYj7VcCxzUrLiKs53z4 L33w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Jj5AMH+h+oe47dY+EAZY03JsOeanI4Ua7kuFCimldDE=; b=it4n/1QmZFbBL/ILIzvJQk4XUXmBsId8iN2lXWcvDvrZEFasc+JEoB4oRNat4NeSFu yfddUzxbaDOuS8/AQls9sgffiNgX7t7ii482eoAF6lfaC/3FQy6fAzf1k5vtMbDOQjLO OV9Nfeh6gXiGAtXm/tDAzXSP6Ebaco0JAXeDfjAfn4VP2hUL4Z8i5ZDvXvbGGpSQiNK4 PSmyWcc3LTydT0+fRp399Us990I2fkHX5jmo2GsONMmHUP0IbBS1d3k5gvLePy+I7DTU qVcHZo5xygbNxAiJO9hk1mrAIfj5rGC1yIn6eCQeAfFcj3tD2VW7vGfw8EU038pB82m6 wzYg== X-Gm-Message-State: AOUpUlEilV3asz96bCeyJizV+0gNgQnqiY71WLpTInsBSULlAIvqPZTq KOdxEd7iupSZqpX8NZL3i3NPbXNV X-Google-Smtp-Source: AA+uWPwGsQRp5hCxqfNuLIRIbi7lC1GRUknZatVKmS7Pkg7ISBN+f21AWjlTuW0Clw/eiHUnY1/Icw== X-Received: by 2002:a02:13c6:: with SMTP id 189-v6mr636080jaz.50.1533689147048; Tue, 07 Aug 2018 17:45:47 -0700 (PDT) Original-Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id m23-v6sm1385306iti.27.2018.08.07.17.45.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Aug 2018 17:45:46 -0700 (PDT) In-Reply-To: (T. V. Raman's message of "Thu, 02 Aug 2018 08:25:03 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149341 Archived-At: --=-=-= Content-Type: text/plain tags 32348 + patch quit "T.V Raman" 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Optionally-skip-rendering-of-tags-with-aria-hidden-B.patch Content-Description: patch >From b56b24a1a40fdce7746ff0f81570b29c83309c12 Mon Sep 17 00:00:00 2001 From: Noam Postavsky 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 --=-=-=--