<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Johannes Odland</title>
  <subtitle>Infrequent posts about CSS and other frontend stuff.</subtitle>
  <link href="https://johannesodland.github.io/feed.xml" rel="self" />
  <link href="https://johannesodland.github.io/" />
  <updated>2024-12-24T09:30:00Z</updated>
  <id>https://johannesodland.github.io/</id>
  <author>
    <name>Johannes Odland</name>
  </author>
  <entry>
    <title>Web Wish 24: ::first-letter</title>
    <link href="https://johannesodland.github.io/2024/12/24/web-wish-24-first-letter.html" />
    <updated>2024-12-24T09:30:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/24/web-wish-24-first-letter.html</id>
    <content type="html">&lt;p&gt;Finding the wish for my 24th entry was no small task.
But, I decided to focus on a long-standing wish of mine: making &lt;code&gt;::first-letter&lt;/code&gt; work with Norwegian typography.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;::first-letter&lt;/code&gt; lets you select the first letter of an element – including associated punctuation.
One of its major use cases is to allow authors to create drop caps and other types of enlarged initials.&lt;/p&gt;
&lt;p&gt;However, typographical conventions vary across countries and languages.
For instance, in Norwegian, a line can start with a guillemet (&lt;code&gt;«&lt;/code&gt;) or a quotation dash with an intervening white space (&lt;code&gt;- &lt;/code&gt;).
These opening quotation marks should be included in &lt;code&gt;::first-letter&lt;/code&gt; alongside the following letter.&lt;/p&gt;
&lt;p&gt;For a time, it seemed CSS would support this quotation dash convention,
but it was later resolved to allow only typographic spaces in the &lt;code&gt;::first-letter&lt;/code&gt;, disallowing regular space and no-break space.&lt;/p&gt;
&lt;p&gt;While there are many typographic spaces, none match the size of a regular space,
which adjusts with the font&#39;s width.
To my knowledge, no other space can substitute for a regular space (U+0020) or a no-break space (U+00A0).&lt;/p&gt;
&lt;p&gt;So, for Christmas Eve I&#39;m wishing for the CSS pseudo-elements specification to support quotation dashes with regular and no-break spaces.&lt;/p&gt;
&lt;p&gt;Relevant issues and PRs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/9413&quot;&gt;[css-pseudo-4] Allow intervening space and no-break space in ::first-letter, preceding the letter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 23: Children Changed Callback</title>
    <link href="https://johannesodland.github.io/2024/12/23/web-wish-23-children-changed-callback.html" />
    <updated>2024-12-23T15:00:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/23/web-wish-23-children-changed-callback.html</id>
    <content type="html">&lt;p&gt;Handling nested custom elements can be frustrating.&lt;/p&gt;
&lt;p&gt;When the parent element is connected, it might have all, some or none of its children connected,
depending on how the custom element is constructed.
More children can be added later by the parser or a script.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;span class=&quot;token language-javascript&quot;&gt;
    &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ChildCountComponent&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;HTMLElement&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;token function&quot;&gt;connectedCallback&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
            console&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token template-string&quot;&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;localName&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; has &lt;/span&gt;&lt;span class=&quot;token interpolation&quot;&gt;&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;children&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length&lt;span class=&quot;token interpolation-punctuation punctuation&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt; children when connected&lt;/span&gt;&lt;span class=&quot;token template-punctuation string&quot;&gt;`&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;
    customElements&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;component-a&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ComponentA&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ChildCountComponent&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;component-a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Child&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;component-a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;component-b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Child&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;p&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;component-b&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token script&quot;&gt;&lt;span class=&quot;token language-javascript&quot;&gt;
    customElements&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;define&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&quot;component-b&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ComponentB&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;token class-name&quot;&gt;ChildCountComponent&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;script&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the example above, &lt;code&gt;&amp;lt;component-a&amp;gt;&lt;/code&gt; will have 0 children when connected, as the element is already defined when the parser encounters the element.
&lt;code&gt;&amp;lt;component-b&amp;gt;&lt;/code&gt; will have 1 child when connected, as the custom element is upgraded after the parser is done.&lt;/p&gt;
&lt;p&gt;To handle all of these cases, you have to set up a &lt;code&gt;MutationObserver&lt;/code&gt; and react to the addition (and removals) of child nodes.
You could set a timeout, and pray the browser is done parsing the component when it yields. Risky business 😅.&lt;/p&gt;
&lt;p&gt;Even if you manage handle the addition and removal of children, there&#39;s a remaining issue.
If the child is a custom-element itself, can you be sure it&#39;s upgraded?&lt;/p&gt;
&lt;p&gt;You could wait for &lt;code&gt;customElements.whenDefined()&lt;/code&gt; if you control that child element yourself,
but that doesn&#39;t work if the definition of that custom element is out of your control.&lt;/p&gt;
&lt;p&gt;To make all of this a bit simpler, I wish for &lt;code&gt;childChangedCallback()&lt;/code&gt; and &lt;code&gt;childDefinedCallback()&lt;/code&gt; lifecycle callbacks.&lt;/p&gt;
&lt;p&gt;Relevant issues and PRs:&lt;/p&gt;
&lt;p&gt;– &lt;a href=&quot;https://github.com/WICG/webcomponents/issues/809&quot;&gt;Need a callback for when children changed or parser finished parsing children&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 22: Flex-Wrap Balance</title>
    <link href="https://johannesodland.github.io/2024/12/22/web-wish-22-flex-wrap-balance.html" />
    <updated>2024-12-22T15:00:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/22/web-wish-22-flex-wrap-balance.html</id>
    <content type="html">&lt;p&gt;When using flexbox to layout items in multiple rows, you easily end up with only one or a few items on the last row.
All the remaining space is distributed to the last row.&lt;/p&gt;
&lt;figure&gt;
    &lt;img src=&quot;https://johannesodland.github.io/assets/web-wishlist-2024/flex-wrap-balance/flex-wrap-balance-none.png&quot; alt=&quot;Illustration of a flex container with 10 items. 
It has three rows with three items each, and the fourth row has a single item&quot;&gt;
    &lt;figcaption&gt;
        A flex-container with no balancing. 
    &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;If you&#39;re also using &lt;code&gt;flex: auto&lt;/code&gt; on the items to make them fill the entire row,
the items on that last row can end up awkwardly large.&lt;/p&gt;
&lt;figure&gt;
    &lt;img src=&quot;https://johannesodland.github.io/assets/web-wishlist-2024/flex-wrap-balance/flex-wrap-balance-none-flex.png&quot; alt=&quot;Illustration of a flex container with 10 items. 
It has three rows with three items each, and the fourth row has a single item. 
The items are stretched to fill the entire row, making the last item as wide as the container.&quot;&gt;
    &lt;figcaption&gt;
        A flex-container with no balancing and `flex: auto` on the items.
        The item on the last row is ends up filling the entire width of the container. 
    &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;What if we could control this, similarly to how we control text wrapping with &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/text-wrap&quot;&gt;&lt;code&gt;text-wrap: balance&lt;/code&gt;&lt;/a&gt;?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Then we could ensure a more even balancing, and that the last row does not end up with a single item.&lt;/p&gt;
&lt;figure&gt;
    &lt;img src=&quot;https://johannesodland.github.io/assets/web-wishlist-2024/flex-wrap-balance/flex-wrap-balance-start-flex.png&quot; alt=&quot;Illustration of a flex container with 10 items. 
It has four rows in total. The first two rows contains three items each, while the remaining two rows contain two items each. 
The items are stretched to fill the entire row.&quot;&gt;
    &lt;figcaption&gt;
        A flex-container with balancing.
    &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;But, there&#39;s room to improve!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A normal pattern is to give the first items in a layout some extra focus.
What if we could control how the wrapping algorithm distribute the extra space?
Then we could control whether the remaining space would be distributed towards the start or the end of the cross axis.&lt;/p&gt;
&lt;figure&gt;
    &lt;img src=&quot;https://johannesodland.github.io/assets/web-wishlist-2024/flex-wrap-balance/flex-wrap-balance-end-flex.png&quot; alt=&quot;Illustration of a flex container with 10 items. 
It has four rows in total. The first two rows contains two items each, while the remaining two rows contain three items each. 
The items are stretched to fill the entire row.&quot;&gt;
    &lt;figcaption&gt;
        A flex-container with balancing and control over distribution of the free space.
    &lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This would help immensely when setting up a product page or an image gallery.&lt;/p&gt;
&lt;p&gt;For Christmas, I&#39;m hoping the CSS working group will resolve to specify flex-wrap balancing.&lt;/p&gt;
&lt;p&gt;Relevant issues and PRs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/3070&quot;&gt;[css-flexbox-2] Add flex-wrap: balance;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 21: Has Slotted</title>
    <link href="https://johannesodland.github.io/2024/12/21/web-wish-21-has-slotted.html" />
    <updated>2024-12-21T15:00:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/21/web-wish-21-has-slotted.html</id>
    <content type="html">&lt;p&gt;Need to style your web-component differently depending on whether a slot has a slotted element?&lt;/p&gt;
&lt;p&gt;Right now you would need to listen to the &lt;code&gt;slotchange&lt;/code&gt; event, and check if the slot has any &lt;code&gt;assignedNodes&lt;/code&gt;, and set a class to style the element.&lt;/p&gt;
&lt;pre class=&quot;language-js&quot;&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; slots &lt;span class=&quot;token operator&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;token keyword&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;shadowRoot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;querySelectorAll&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;slot&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token keyword&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token keyword&quot;&gt;const&lt;/span&gt; slot &lt;span class=&quot;token keyword&quot;&gt;of&lt;/span&gt; slots&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  slot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;addEventListener&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;slotchange&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;token operator&quot;&gt;=&gt;&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
    slot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;classList&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;toggle&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token string&quot;&gt;&#39;has-slotted&#39;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; slot&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;token function&quot;&gt;assignedNodes&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;.&lt;/span&gt;length &lt;span class=&quot;token operator&quot;&gt;&gt;&lt;/span&gt; &lt;span class=&quot;token number&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;slot:not(.has-slotted)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It would be awesome if it was possible to style the slot based on whether it has slotted content, without waiting for the javascript to run.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token selector&quot;&gt;slot:not(:has-slotted)&lt;/span&gt; &lt;span class=&quot;token punctuation&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;token property&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; none&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token punctuation&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There is an open &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/6867&quot;&gt;issue for a &lt;code&gt;:has-slotted&lt;/code&gt; pseudo-class&lt;/a&gt;, and things have been moving fast.&lt;/p&gt;
&lt;p&gt;The CSS Scoping spec is now updated with a &lt;a href=&quot;https://drafts.csswg.org/css-scoping/#the-has-slotted-pseudo&quot;&gt;&lt;code&gt;:has-slotted&lt;/code&gt; section&lt;/a&gt;,
and there are prototypes in &lt;a href=&quot;https://chromestatus.com/feature/5134941143433216&quot;&gt;Chrome&lt;/a&gt; and &lt;a href=&quot;https://bugzilla.mozilla.org/show_bug.cgi?id=1921747&quot;&gt;in Firefox&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I hope the CSSWG keep up the momentum, so that we might soon have a &lt;code&gt;:has-slotted&lt;/code&gt; pseudo-class,
and perhaps, in time, a functional &lt;code&gt;:has-slotted()&lt;/code&gt; pseudo-class.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 20: Text Fill</title>
    <link href="https://johannesodland.github.io/2024/12/20/web-wish-20-text-fill.html" />
    <updated>2024-12-20T15:00:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/20/web-wish-20-text-fill.html</id>
    <content type="html">&lt;p&gt;If you need a text with a fill, you can always put that fill in the background,
clip the background to the text, and make the text transparent so that the clipped background becomes visible.&lt;/p&gt;
&lt;p&gt;It works across all modern browsers.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;linear-gradient&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;to bottom in oklch&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; blue&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;background-clip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; text&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; transparent&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p class=&quot;example-1&quot;&gt;&lt;span&gt;Text with a gradient background fill&lt;/span&gt;&lt;/p&gt;
&lt;style&gt;
.example-1 {
    text-transform: uppercase;
    font-weight: 700;
    font-size: 1.5em;
    text-align: center;
    span {
        background-image: linear-gradient(to bottom in oklch, blue, red);
        background-clip: text;
        color: transparent;
        -webkit-box-decoration-break: clone;
        box-decoration-break: clone;
    }
}
&lt;/style&gt;
&lt;p&gt;But, if you use &lt;code&gt;text-shadow&lt;/code&gt; on the element, you might be in for a surprise.
The “text” you see is a clipped background, and the text-shadow will be painted on top of it.&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;background-image&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;token function&quot;&gt;linear-gradient&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;(&lt;/span&gt;to bottom in oklch&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; blue&lt;span class=&quot;token punctuation&quot;&gt;,&lt;/span&gt; red&lt;span class=&quot;token punctuation&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;background-clip&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; text&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; transparent&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;token property&quot;&gt;text-shadow&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; 1px 1px 0 black&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p class=&quot;example-2&quot;&gt;&lt;span&gt;Text with a black text-shadow on top&lt;/span&gt;&lt;/p&gt;
&lt;style&gt;
.example-2 {
    text-transform: uppercase;
    font-weight: 700;
    font-size: 1.5em;
    text-align: center;
    span {
        background-image: linear-gradient(to bottom in oklch, blue, red);
        background-clip: text;
        color: transparent;
        text-shadow: 1px 1px 0 black;
        -webkit-box-decoration-break: clone;
        box-decoration-break: clone; 
    }
}
&lt;/style&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.w3.org/TR/fill-stroke-3/&quot;&gt;CSS Fill and Stroke Module&lt;/a&gt; defines a &lt;code&gt;fill-image&lt;/code&gt; property that would let you fill the text properly,
so that it would work in combination with the &lt;code&gt;text-shadow&lt;/code&gt; property.
As far as I know, none of the browsers implement this property for inline text elements.&lt;/p&gt;
&lt;p&gt;Today I&#39;m wishing for browser implementers to support the &lt;code&gt;fill-*&lt;/code&gt; properties for inline text.&lt;/p&gt;
&lt;p&gt;Relevant issues and PRs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://issues.chromium.org/issues/354087606&quot;&gt;text-shadow paints on top of text styled with background-clip: text;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 19: Display Invisible Characters</title>
    <link href="https://johannesodland.github.io/2024/12/19/web-wish-19-display-invisible-characters.html" />
    <updated>2024-12-19T15:00:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/19/web-wish-19-display-invisible-characters.html</id>
    <content type="html">&lt;p&gt;Typography holds particular interest for me,
coming from a small country where unique typographical conventions emerged
alongside our journey to independence from a union with neighboring countries.&lt;/p&gt;
&lt;p&gt;Maintaining those conventions is hard, as technology has continually eroded them.&lt;/p&gt;
&lt;p&gt;Numbers, in Norwegian, should be formatted with space as a thousands separator.
To ensure numbers are not broken across lines, a non-breaking space should be used.&lt;/p&gt;
&lt;p&gt;But, non-breaking spaces are hard to enter and impossible to visually distinguish from regular spaces in an input field.&lt;/p&gt;
&lt;p&gt;Similarly, it&#39;s impossible to verify that soft-hyphens are inserted at the correct positions.
Without soft-hyphens, long compound words can be pushed entirely to the next line,
disrupting the flow of text and making it harder to read.&lt;/p&gt;
&lt;p&gt;Both of these are important characters when preparing Norwegian text for publication.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The core issue is that invisible characters are nearly undetectable during editing.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This issue has been solved in other tools, like Word,
which allow toggling the visibility of invisible characters during editing.
We should be able to solve it on the web as well.&lt;/p&gt;
&lt;p&gt;Fortunately, there&#39;s a &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/8874&quot;&gt;proposal for toggling the visibility of invisible characters&lt;/a&gt; using
&lt;code&gt;text-transform&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre class=&quot;language-css&quot;&gt;&lt;code class=&quot;language-css&quot;&gt;&lt;span class=&quot;token property&quot;&gt;text-transform&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;:&lt;/span&gt; visible-whitespace&lt;span class=&quot;token punctuation&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This holiday, I&#39;m wishing for progress in standardizing a way to show these invisible characters in editors.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 18: Sticky Next</title>
    <link href="https://johannesodland.github.io/2024/12/18/web-wish-18-sticky-next.html" />
    <updated>2024-12-18T15:00:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/18/web-wish-18-sticky-next.html</id>
    <content type="html">&lt;p&gt;Sticky positioning lets you “stick” an element to a position relative to the scroll-port,
instead of scrolling it out of the screen.&lt;/p&gt;
&lt;p&gt;It&#39;s awesome.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;But o, so limiting.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The element will only be “stuck” as far as is possible while staying within its containing block,
which is the nearest block-level container.
It would be great if we could &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/9868&quot;&gt;choose a different containing block&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It&#39;s not really possible to configure how far inside that containing it should stay sticky.
Or, it is, but the CSS working group has &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/9052#issuecomment-1642600755&quot;&gt;resolved to remove that option&lt;/a&gt;.
It would be awesome if it was possible to &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/10754&quot;&gt;configure the insets from the containing block&lt;/a&gt;,
and not just the insets from the scroll-port.&lt;/p&gt;
&lt;p&gt;It would also be awesome if we could let sticky elements &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/2496#issuecomment-1002312635&quot;&gt;stack against each other&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, this year I&#39;m hoping the CSS working group and browser implementors can start looking into how we can make sticky positioning even better.&lt;/p&gt;
&lt;p&gt;Relevant issues and PRs:&lt;/p&gt;
&lt;p&gt;– &lt;a href=&quot;https://github.com/w3c/csswg-drafts/issues/11145&quot;&gt;[css-position] Meta-issue: Unresolved sticky positioning use cases&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 17: Viewport Relative Lengths</title>
    <link href="https://johannesodland.github.io/2024/12/17/web-wish-17-viewport-relative-lengths.html" />
    <updated>2024-12-17T19:00:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/17/web-wish-17-viewport-relative-lengths.html</id>
    <content type="html">&lt;p&gt;Viewport relative units come in really handy when you need to size elements relative to the viewport,
say a hero element that should have the exact size of the viewport.&lt;/p&gt;
&lt;p&gt;There&#39;s one catch though, the size of the viewport can change dynamically as mobile browser interfaces,
like the address bar, expand and collapse as users scroll.
If the elements on the page expand and collapse as a result, the layout of the page ends up unstable,
and the user can experience bouncing around the page as he changes scroll direction.&lt;/p&gt;
&lt;p&gt;This is why browsers made &lt;code&gt;vh&lt;/code&gt; units stable, reflecting the size of the viewport with browser interfaces collapsed.
This ensures that the layout does not shift unexpectedly, providing a smoother user experience.&lt;/p&gt;
&lt;p&gt;This also prompted the CSS working group to standardize new viewport units.
The new units include two stable sets: one for the large viewport with interfaces retracted (&lt;code&gt;lv*&lt;/code&gt;), and one for the small viewport with user interfaces expanded (&lt;code&gt;sv*&lt;/code&gt;).
The final set of units allows authors to opt in to dynamic sizes (&lt;code&gt;dv*&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Most of the major browsers support the new viewport units correctly, &lt;a href=&quot;https://github.com/mozilla-mobile/firefox-ios/issues/22607&quot;&gt;except for Firefox on iOS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The new units were a big step forward, but there&#39;s still a challenge: inconsistent support in In App Browsers (IABs).
Apps like social media, messaging platforms and other services often open links in IABs, to keep users within their ecosystems.
Unfortunately many of these IABs fail to implement viewport units correctly.&lt;/p&gt;
&lt;p&gt;In fact, the SFSafariViewController does not seem to &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=255708&quot;&gt;handle the viewport units correctly&lt;/a&gt;.
This is particularly problematic, since SFSafariViewController is widely used in popular apps like Slack.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;This is a major frustration for authors that have to maintain fragile javascript workarounds to make sure their page layout doesn&#39;t break
– and for users who experience broken pages as a result.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Today, I&#39;m wishing for Apple and app developers to collaborate on fixing viewport units in IABs,
making viewport-based layouts more reliable for authors and users alike.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 16: Role Text Next</title>
    <link href="https://johannesodland.github.io/2024/12/16/web-wish-16-role-text-alternative.html" />
    <updated>2024-12-16T15:00:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/16/web-wish-16-role-text-alternative.html</id>
    <content type="html">&lt;p&gt;How should &lt;code&gt;&amp;lt;span&amp;gt;C&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;A&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;T&amp;lt;/span&amp;gt;&lt;/code&gt; or &lt;code&gt;IV&lt;/code&gt; be read by Assistive Technology (AT)?
Should it be pronounced “C-A-T” and “I-V” or as “cat” and “Roman numeral four”?&lt;/p&gt;
&lt;p&gt;Currently, this decision is left up to AT and browsers, which is practical and “safe”.
As authors we can&#39;t predict if the content will be spoken aloud or rendered in braille.&lt;/p&gt;
&lt;p&gt;However, the AT and the browser can&#39;t always infer the authors intent.
For example, splitting cat into separate spans might be purely decorative,
and “IV” could mean intravenous in stead of a numeral.&lt;/p&gt;
&lt;h2&gt;Say Hello (and Goodbye) to &lt;code&gt;role=text&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;For a time there was &lt;a href=&quot;https://github.com/w3c/aria/issues/870&quot;&gt;a proposal to add &lt;code&gt;role=text&lt;/code&gt;&lt;/a&gt; to ARIA.
This role would flatten the accessibility tree, presenting the contents as plain text.
Additionally, it would allow &lt;code&gt;aria-label&lt;/code&gt; to override the presentation of the contents.&lt;/p&gt;
&lt;p&gt;Both WebKit and Blink implemented support for &lt;code&gt;role=text&lt;/code&gt;, and many sites started to rely on it.
But in 2023 &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=260641&quot;&gt;WebKit dropped support&lt;/a&gt;,
and ARIA closed the &lt;a href=&quot;https://github.com/w3c/aria/issues/870&quot;&gt;re-add role=text issue&lt;/a&gt; shortly after.&lt;/p&gt;
&lt;h2&gt;Why &lt;code&gt;role=text&lt;/code&gt; Failed&lt;/h2&gt;
&lt;p&gt;Many opposed &lt;code&gt;role=text&lt;/code&gt;, and with good reason:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Flatting the accessibility hides the underlying structure, which can deny the users the ability to inspect the original content.&lt;/li&gt;
&lt;li&gt;While breaking up &lt;code&gt;IV&lt;/code&gt; into &lt;code&gt;I V&lt;/code&gt; might help speech synthesis, it could confuse braille users by teaching incorrect spellings.&lt;/li&gt;
&lt;li&gt;Often there&#39;s a better solution, such as using &lt;code&gt;role=img&lt;/code&gt; in &lt;code&gt;&amp;lt;span role=&amp;quot;img&amp;quot; aria-label=&amp;quot;love&amp;quot;&amp;gt;♥︎&amp;lt;/span&amp;gt; New York.&lt;/code&gt;
Here &lt;code&gt;role=img&lt;/code&gt; communicates that “love” is represented as an icon.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Today &lt;code&gt;role=text&lt;/code&gt; is practically dead, though it&#39;s still &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=260685&quot;&gt;behind a flag in WebKit&lt;/a&gt;,
awaiting complete removal if there&#39;s no protests.&lt;/p&gt;
&lt;h2&gt;Exploring Alternatives&lt;/h2&gt;
&lt;p&gt;For a while there was an initiative to &lt;a href=&quot;https://github.com/w3c/aria/issues/699&quot;&gt;add a new &lt;code&gt;aria-textseparation&lt;/code&gt; property&lt;/a&gt;
that would let authors specify how text content should be separated from neighbouring elements.
Unfortunately the proposal has been stagnant since 2019.&lt;/p&gt;
&lt;p&gt;There has been some progress, though.
ARIA 1.3 has added &lt;code&gt;aria-braillelabel&lt;/code&gt; that allows us to provide a separate accessible name for Braille.
There is also ongoing work to &lt;a href=&quot;https://www.w3.org/WAI/pronunciation/&quot;&gt;enable text-to-speach to pronounce words correctly&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;The Remaining Issue&lt;/h2&gt;
&lt;p&gt;An unresolved problem involves text that is split into separate inline elements for presentational purposes.&lt;/p&gt;
&lt;p&gt;Consider the following example:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#...&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token special-attr&quot;&gt;&lt;span class=&quot;token attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token value css language-css&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;Fear the goverments&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt; &lt;span class=&quot;token special-attr&quot;&gt;&lt;span class=&quot;token attr-name&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token value css language-css&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;gift will be expencive&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Using VoiceOver on an iPhone, this will read as two separate elements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;“Fear the governments, link”&lt;/li&gt;
&lt;li&gt;“gift will be expensive, link”.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Luckily, for anchor elements (and others with a role that accept &lt;code&gt;aria-label&lt;/code&gt;) we can fix this:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;#...&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;aria-label&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;Fear the governments gift will be expensive&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;...&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;`&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, if the text isn&#39;t part of an element that support &lt;code&gt;aria-label&lt;/code&gt;,
there is no way to tell AT whether to read the text continuously or with pauses.&lt;/p&gt;
&lt;p&gt;It&#39;s important for AT users to inspect structural changes, but excessive detail can create noise.
I see that in many cases AT users should be able to inspect that something is happening with the text,
For instance:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;C&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;A&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;T&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This might be split for animation purposes, and would be invisible to users with &lt;code&gt;prefers-reduced-motion: reduce&lt;/code&gt;.
However, some AT would still read each characters separately, leading to a noisy experience.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Excessive verbosity can sometimes hinder more than help.&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;My holiday wish&lt;/h2&gt;
&lt;p&gt;This Holiday season, I&#39;m wishing for a new solution to help AT interpret text that is split into individual elements.
It seems like &lt;code&gt;role=text&lt;/code&gt; wasn&#39;t the answer. &lt;a href=&quot;https://github.com/w3c/aria/issues/699&quot;&gt;&lt;code&gt;aria-textseparation&lt;/code&gt;&lt;/a&gt; seems to have faded away.
What we need is the next &lt;code&gt;role=text&lt;/code&gt;.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Web Wish 15: Transparent Video</title>
    <link href="https://johannesodland.github.io/2024/12/15/web-wish-15-transparent-video.html" />
    <updated>2024-12-15T17:45:00Z</updated>
    <id>https://johannesodland.github.io/2024/12/15/web-wish-15-transparent-video.html</id>
    <content type="html">&lt;p&gt;Today&#39;s wish is pretty simple.&lt;/p&gt;
&lt;p&gt;We use plenty of videos on our site that are not traditional youtube-style video.
This can for example be infographics or other visualizations.&lt;/p&gt;
&lt;p&gt;A common denominator is that the content should be able to be integrated seamlessly into the site.
It is possible to embed a background color into the video.
Unfortunately, the compressed colors will often stand out like a sore thumb, as they don&#39;t match the colors of the page.&lt;/p&gt;
&lt;p&gt;Additionally, it should be possible to reuse the video in different sections of the page,
and those sections might have different backgrounds.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To address this we need transparent video.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, there&#39;s no single codec that supports this across browsers and devices.
&lt;a href=&quot;https://jakearchibald.com/&quot;&gt;Jake Archibald&lt;/a&gt; has described this issue in detail in &lt;a href=&quot;https://jakearchibald.com/2024/video-with-transparency/&quot;&gt;Video with alpha transparency on the web&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This Christmas I&#39;m wishing for browser developers to put transparent video on their roadmap.&lt;/p&gt;
</content>
  </entry>
</feed>