Skip to content

Commit

Permalink
Change dir=auto to fall back to ltr rather than inheriting
Browse files Browse the repository at this point in the history
This restores the old behavior that was part of the spec from November
2010 to April 2013, which is that elements with dir=auto (and <bdi>
without dir) that contain no strong LTR or strong RTL characters fall
back to ltr, rather than inheriting the parent's directionality.

This matches what is implemented in Gecko and WebKit, and what was
implemented in Chromium until a few months ago. A small number of
regressions were reported as a result of this change. Given that I
don't see a clear consensus that the spec behavior is better, it seems
better to revert back to the existing behavior and avoid breaking some
existing content that depends on it.

Fixes #10097.
  • Loading branch information
dbaron committed Feb 22, 2024
1 parent 30ca507 commit 9d22133
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -13605,8 +13605,8 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
<li><p>Let <var>result</var> be the <span>auto directionality</span> of
<var>element</var>.</p></li>

<li><p>If <var>result</var> is null, then return the <span>parent directionality</span> of
<var>element</var>.</p></li>
<li><p>If <var>result</var> is null, then return '<span
data-x="concept-ltr">ltr</span>'.</p></li>

<li><p>Return <var>result</var>.</p></li>
</ol>
Expand All @@ -13615,9 +13615,18 @@ Transport Protocol">HTTP&lt;/abbr> today.&lt;/p></code></pre> <!-- DO NOT REWRAP
<dt><span data-x="attr-dir-undefined-state">undefined</span></dt>
<dd>
<dl class="switch">
<dt>If <var>element</var> is a <code>bdi</code> element and the <span>auto
directionality</span> of <var>element</var> is not null</dt>
<dd><p>Return the <span>auto directionality</span> of <var>element</var>.</p></dd>
<dt>If <var>element</var> is a <code>bdi</code> element</dt>
<dd>
<ol>
<li><p>Let <var>result</var> be the <span>auto directionality</span> of
<var>element</var>.</p></li>

<li><p>If <var>result</var> is null, then return '<span
data-x="concept-ltr">ltr</span>'.</p></li>

<li><p>Return <var>result</var>.</p></li>
</ol>
</dd>

<dt>If <var>element</var> is an <code>input</code> element whose <code
data-x="attr-input-type">type</code> attribute is in the <span
Expand Down

0 comments on commit 9d22133

Please sign in to comment.