all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
@ 2018-09-27 13:18 Kaushal Modi
  2018-09-27 13:50 ` Noam Postavsky
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2018-09-27 13:18 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

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

Hello,

In my blog, I insert 2 ToCs. One which includes all levels of headings, and
is inserted in the sidebar when the screen is wide enough. The another
shorter ToC is inserted in-page when the screen is narrow. (Well, in the
below example, both are the same.. but I didn't also want to paste a
screenshot that's bigger than what it already is).

On regular web browers, I don't see both ToC at the same time because I
control which one of the two is shown, using CSS.

Eww does not use the CSS. So it shows both simultaneously as you seen in
the screenshot (which might show up as attached image based on your email
client).

So.. Is there a special tag/class that I can use to prevent showing one of
the two ToCs in eww? If not, can a feature like that be added?

Here's the page URL I used for the screenshot if you want to try it
yourself in eww: https://scripter.co/nim-deploying-static-binaries/.

Thanks!

[image: image.png]

--
Kaushal Modi

[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 96861 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 13:18 Are there some HTML tags that I can use to make certain blocks auto-hide in eww? Kaushal Modi
@ 2018-09-27 13:50 ` Noam Postavsky
  2018-09-27 13:55   ` Kaushal Modi
  0 siblings, 1 reply; 10+ messages in thread
From: Noam Postavsky @ 2018-09-27 13:50 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Help Gnu Emacs mailing list

On Thu, 27 Sep 2018 at 09:19, Kaushal Modi <kaushal.modi@gmail.com> wrote:

> On regular web browers, I don't see both ToC at the same time because I
> control which one of the two is shown, using CSS.
>
> Eww does not use the CSS. So it shows both simultaneously as you seen in
> the screenshot (which might show up as attached image based on your email
> client).
>
> So.. Is there a special tag/class that I can use to prevent showing one of
> the two ToCs in eww? If not, can a feature like that be added?

Eww (or more specifically, shr) supports inline styles, using
style="display:none" on a tag does hide it in Eww. If you're using a
recent Emacs from master, aria-hidden="true" also works (generally,
this is meant to hide it from screen-readers, see Bug#32348).



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 13:50 ` Noam Postavsky
@ 2018-09-27 13:55   ` Kaushal Modi
  2018-09-27 14:25     ` Noam Postavsky
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2018-09-27 13:55 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Help Gnu Emacs mailing list

On Thu, Sep 27, 2018 at 9:50 AM Noam Postavsky <npostavs@gmail.com> wrote:

>
> Eww (or more specifically, shr) supports inline styles, using
> style="display:none" on a tag does hide it in Eww.


Wouldn't that permanently hide the tag? Not a web expert, but can inline
styles be overridden by external CSS?


> If you're using a
> recent Emacs from master, aria-hidden="true" also works (generally,
> this is meant to hide it from screen-readers, see Bug#32348).
>

I looked at this one, but hiding the aria-hidden is disabled by default.

C-h v shr-discard-aria-hidden shows that it is nil by default.

I was looking for a way to have my site "just work as I expect" without
having users need to set shr-discard-aria-hidden to t.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 13:55   ` Kaushal Modi
@ 2018-09-27 14:25     ` Noam Postavsky
  2018-09-27 15:25       ` Kaushal Modi
  0 siblings, 1 reply; 10+ messages in thread
From: Noam Postavsky @ 2018-09-27 14:25 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Help Gnu Emacs mailing list

>> Eww (or more specifically, shr) supports inline styles, using
>> style="display:none" on a tag does hide it in Eww.
>
> Wouldn't that permanently hide the tag? Not a web expert, but can inline styles be overridden by external CSS?

Not a web expert either, but yes, I think it's permanent. I don't
think Eww supports dynamic modification of the display.

>> recent Emacs from master, aria-hidden="true" also works (generally,
>> this is meant to hide it from screen-readers, see Bug#32348).
>
> I looked at this one, but hiding the aria-hidden is disabled by default.
>
> C-h v shr-discard-aria-hidden shows that it is nil by default.

Right, I forgot to mention that.

> I was looking for a way to have my site "just work as I expect" without having users need to set shr-discard-aria-hidden to t.

Possibly setting shr-discard-aria-hidden to t by default would make
sense, I just don't feel familiar enough with its usage in practice to
make that call.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 14:25     ` Noam Postavsky
@ 2018-09-27 15:25       ` Kaushal Modi
  2018-09-27 15:42         ` T.V Raman
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2018-09-27 15:25 UTC (permalink / raw)
  To: Noam Postavsky, Lars Ingebrigtsen, raman; +Cc: Help Gnu Emacs mailing list

On Thu, Sep 27, 2018 at 10:25 AM Noam Postavsky <npostavs@gmail.com> wrote:

> Possibly setting shr-discard-aria-hidden to t by default would make
> sense, I just don't feel familiar enough with its usage in practice to
> make that call.
>

Copying Lars and T.V. Raman (OP of
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32348) for their opinion on
this.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 15:25       ` Kaushal Modi
@ 2018-09-27 15:42         ` T.V Raman
  2018-09-27 15:45           ` Kaushal Modi
  0 siblings, 1 reply; 10+ messages in thread
From: T.V Raman @ 2018-09-27 15:42 UTC (permalink / raw)
  To: kaushal.modi; +Cc: help-gnu-emacs, larsi, npostavs, raman

That option was added to hide nodes with aria-hidden=true.

That HTML attribute --- aria-hidden --- comes from the W3C ARIA Spec
(Access To Rich Internet Applications) and the motivation there was
to avoid accidentally rendering DOM nodes that have HTML content, but
are normally hidden from being rendered by JavaScript. Since one
cannot figure that out by analysing JS code (Halting Problem), we at
the time decided to introduce a DOM  attribute  that could be examined
to discover that the state of a DOM node was hidden. Later if a script
makes that node visibly, it  needs to also set that attr to false.

In the case, of EWW, since we dont run JS code, the state of
aria-hidden=true will never change to false from the  initial value
and you can safely drop those nodes.
Kaushal Modi writes:
 > On Thu, Sep 27, 2018 at 10:25 AM Noam Postavsky <npostavs@gmail.com> wrote:
 > 
 > 
 >  Possibly setting shr-discard-aria-hidden to t by default would make
 >  sense, I just don't feel familiar enough with its usage in practice to
 >  make that call.
 > 
 > 
 > Copying Lars and T.V. Raman (OP of https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32348) for their opinion on this.

-- 
Id: kg:/m/0285kf1 

-- 
Id: kg:/m/0285kf1 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 15:42         ` T.V Raman
@ 2018-09-27 15:45           ` Kaushal Modi
  2018-09-27 15:48             ` T.V Raman
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2018-09-27 15:45 UTC (permalink / raw)
  To: raman; +Cc: Help Gnu Emacs mailing list, Lars Ingebrigtsen, Noam Postavsky

On Thu, Sep 27, 2018 at 11:42 AM T.V Raman <raman@google.com> wrote:

>
> In the case, of EWW, since we dont run JS code, the state of
> aria-hidden=true will never change to false from the  initial value
> and you can safely drop those nodes.
>

Awesome! Thanks for that background information too.

So I will start annotating "don't show these in eww" tags with
"aria-hidden=true". I hope that the consensus is to default that var to t.
Noam? Eli? Lars?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 15:45           ` Kaushal Modi
@ 2018-09-27 15:48             ` T.V Raman
  2018-09-27 15:50               ` Kaushal Modi
  0 siblings, 1 reply; 10+ messages in thread
From: T.V Raman @ 2018-09-27 15:48 UTC (permalink / raw)
  To: kaushal.modi; +Cc: help-gnu-emacs, larsi, npostavs, raman


Correct, should work. Just remember that if you want those nodes to
ever show up in a   JS-powered browser, you'll need to set that attr
to false in the JS code that unhides it -- otherwise it'll just lead
to differently confusing experiences. 
Kaushal Modi writes:
 > On Thu, Sep 27, 2018 at 11:42 AM T.V Raman <raman@google.com> wrote:
 > 
 > 
 >  In the case, of EWW, since we dont run JS code, the state of
 >  aria-hidden=true will never change to false from the  initial value
 >  and you can safely drop those nodes.
 > 
 > 
 > Awesome! Thanks for that background information too.
 > 
 > So I will start annotating "don't show these in eww" tags with "aria-hidden=true". I hope that the consensus is to default that var to t. Noam? Eli? Lars?

-- 
Id: kg:/m/0285kf1 

-- 
Id: kg:/m/0285kf1 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 15:48             ` T.V Raman
@ 2018-09-27 15:50               ` Kaushal Modi
  2018-09-27 15:54                 ` T.V Raman
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushal Modi @ 2018-09-27 15:50 UTC (permalink / raw)
  To: raman; +Cc: Help Gnu Emacs mailing list, Lars Ingebrigtsen, Noam Postavsky

On Thu, Sep 27, 2018 at 11:48 AM T.V Raman <raman@google.com> wrote:

>
> Correct, should work. Just remember that if you want those nodes to
> ever show up in a   JS-powered browser, you'll need to set that attr
> to false in the JS code that unhides it -- otherwise it'll just lead
> to differently confusing experiences.
>

But adding aria-hidden=true should hide those elements on non-screen
readers like a regular Firefox browser, right? [I know I could have simply
tried that.]


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Are there some HTML tags that I can use to make certain blocks auto-hide in eww?
  2018-09-27 15:50               ` Kaushal Modi
@ 2018-09-27 15:54                 ` T.V Raman
  0 siblings, 0 replies; 10+ messages in thread
From: T.V Raman @ 2018-09-27 15:54 UTC (permalink / raw)
  To: kaushal.modi; +Cc: help-gnu-emacs, larsi, npostavs, raman

As with everything in browsers, "it depends".

What is  guaranteed by the spec: "aria-hidden=true" will hide  those
nodes from a screenreader --- it does not guarantee that it will
always hide it from the visual rendering.

The reasons for this are complex and convoluted.
Kaushal Modi writes:
 > On Thu, Sep 27, 2018 at 11:48 AM T.V Raman <raman@google.com> wrote:
 > 
 > 
 >  Correct, should work. Just remember that if you want those nodes to
 >  ever show up in a   JS-powered browser, you'll need to set that attr
 >  to false in the JS code that unhides it -- otherwise it'll just lead
 >  to differently confusing experiences. 
 > 
 > 
 > But adding aria-hidden=true should hide those elements on non-screen readers like a regular Firefox browser, right? [I know I could have simply tried that.] 

-- 
Id: kg:/m/0285kf1 

-- 
Id: kg:/m/0285kf1 



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-09-27 15:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27 13:18 Are there some HTML tags that I can use to make certain blocks auto-hide in eww? Kaushal Modi
2018-09-27 13:50 ` Noam Postavsky
2018-09-27 13:55   ` Kaushal Modi
2018-09-27 14:25     ` Noam Postavsky
2018-09-27 15:25       ` Kaushal Modi
2018-09-27 15:42         ` T.V Raman
2018-09-27 15:45           ` Kaushal Modi
2018-09-27 15:48             ` T.V Raman
2018-09-27 15:50               ` Kaushal Modi
2018-09-27 15:54                 ` T.V Raman

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.