WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Always adding a dir attribute to <html>

for

From: Patrick H. Lauke
Date: Sep 8, 2023 5:04PM


On 08/09/2023 23:43, H S wrote:
> Then how come document.dir is not ltr if html element has no dir attribute?

Because document.dir "Returns the html element's dir attribute's value,
if any". If the dir attribute is missing, it is not automagically
backfilled/created. The actual computed directionality (e.g. what it is
actually evaluated as when the attribute is missing/empty/contains an
unrecognised value) can't be queried from JS, I believe.

P
--
Patrick H. Lauke

https://www.splintered.co.uk/ | https://github.com/patrickhlauke
https://flickr.com/photos/redux/ | https://www.deviantart.com/redux
https://mastodon.social/@patrick_h_lauke | skype: patrick_h_lauke