@@ -619,20 +619,26 @@ Complex Spanning with Nested Ruby</h4>
619619 Waiting until layout is better-defined to find out...
620620-->
621621
622- <h3 id="autohide">
623- Autohiding Base-identical Annotations</h3>
624-
625- If a [=ruby annotation=] has the exact same text content as its base,
626- it is <dfn lt="hidden ruby annotation | hidden annotation">hidden</dfn> .
627- Hiding a [=ruby annotation=] does not affect annotation [=pairing=] .
622+ <h3 id="hiding" oldids="autohide">
623+ Hiding Annotations: ''visibility: collapse'' and auto-hidden ruby</h3>
624+
625+ A [=ruby annotation=] whose 'visibility' is ''visibility/collapse''
626+ is a <dfn lt="hidden annotation | hidden ruby annotation | hide" local-lt="hidden">hidden annotation</dfn> .
627+ Additionally,
628+ if a [=ruby annotation=] has the exact same text content as its base,
629+ it is automatically [=hidden=]
630+ (<dfn lt="auto-hidden | auto-hide">auto-hidden</dfn> )
631+ by the UA.
632+
633+ [=Hiding=] a [=ruby annotation=] does not affect annotation [=pairing=] .
628634 However the [=hidden annotation=] is not visible,
629635 and it has no impact on layout
630636 other than to separate adjacent sequences of [=ruby annotation boxes=] within its level,
631637 as if they belonged to separate segments
632638 and the [=hidden annotation=] ’s base were not a [=ruby base=] but an intervening inline.
633639
634640 <div class="example">
635- This is to allow correct inlined display of annotations
641+ Auto-hiding allows correct inlined display of annotations
636642 for Japanese words that are a mix of kanji and hiragana.
637643 For example, the word <span lang=ja> 振り仮名</span> should be inlined as
638644
@@ -653,18 +659,80 @@ Autohiding Base-identical Annotations</h3>
653659 </div>
654660 </div>
655661
656- When the computed value of 'ruby-merge' is ''merge'' ,
657- the autohiding is disabled.
658- When the computed value of 'ruby-merge' is ''ruby-merge/auto'' ,
659- the user agent may decide whether to autohide or not,
660- but it is recommended to autohide if the algorithm the user agent chose
661- produces the results similar to ''separate'' would produce.
662+ <div class="example">
663+ The Japanese word in this example is composed of three kanji characters,
664+ one of which is taught in first grade,
665+ while the other two are more advanced.
666+ (Characters colored to show base-pair correspondances.)
667+
668+ <xmp highlight=html>
669+ <ruby><rb> 昆<rb> 虫<rb> 記<rt> こん<rt class=easy> ちゅう<rt> き</ruby>
670+ </xmp>
671+
672+ <figure>
673+ <img src="images/ruby-pairing-full.png" width=122
674+ alt="昆虫記, with phonetic annotations on all three characters.
675+ Because the middle annotation is wider than its base,
676+ space has been introduced around the base character
677+ to prevent its annotation from colliding with the adjacent annotations.">
678+ <figcaption> Fully annotated three-character word</figcaption>
679+ </figure>
680+
681+ Although some readers might need pronunciation guidance
682+ on all three characters,
683+ for other audiences it is more appropriate
684+ to hide the annotation on the easier character.
685+ Applying ''visibility: collapse'' enables this hiding:
686+
687+ <figure>
688+ <img src="images/ruby-pairing-collapse.png" width=105
689+ alt="昆虫記, with phonetic annotations centered over
690+ the first and last characters.">
691+ <figcaption> Middle annotation as ''visibility: collapse'' </figcaption>
692+ </figure>
693+
694+ The [=hiding=] behavior of ''visibility: collapse''
695+ differs from ''visibility: hidden'' --
696+ which makes the annotation invisible,
697+ but does not remove its impact on layout:
698+
699+ <figure>
700+ <img src="images/ruby-pairing-invisible.png" width=122
701+ alt="昆虫記, with phonetic annotations on the first and last characters.
702+ Over the second one, even though no annotation is showing,
703+ space is reserved as if to hold it,
704+ which pushes the base characters apart.">
705+ <figcaption> Middle annotation as ''visibility: hidden'' </figcaption>
706+ </figure>
707+
708+ It also differs from ''display: none''
709+ because ''visibility: collapse'' preserves pairing relationships,
710+ whereas ''display: none'' removes the box from the tree entirely,
711+ disturbing the pairing of any annotations after it:
712+
713+ <figure>
714+ <img src="images/ruby-pairing-discard.png" width=107
715+ alt="昆虫記, with mispaired phonetic annotations:
716+ the annotation for the second character having been removed,
717+ the annotation for the third character is displayed over the second one.">
718+ <figcaption> Middle annotation as ''display: none'' </figcaption>
719+ </figure>
720+ </div>
721+
722+ When the [=computed value=] of 'ruby-merge' on the [=annotation container=]
723+ is ''merge'' ,
724+ [=hiding=] is disabled.
725+ When that value is ''ruby-merge/auto'' ,
726+ the user agent may decide whether to disable [=hiding=] of its annotations,
727+ but it is recommended to enable [=hiding=]
728+ if the user agent’s layout algorithm
729+ produces the results similar to ''separate'' .
662730
663- The content comparison for this auto-hiding behavior
731+ The content comparison for [= auto-hiding=]
664732 takes place prior to white space collapsing ('white-space' ) and text transformation ('text-transform' )
665733 and ignores elements (considers only the <code> textContent</code> of the boxes).
666734
667- Note: Future levels of CSS Ruby may add controls for auto-hiding,
735+ Note: Future levels of CSS Ruby may add controls for [= auto-hiding=] ,
668736 but in this level it is always forced.
669737
670738<h3 id="white-space">
@@ -2186,6 +2254,9 @@ Changes since the 29 April 2020 WD</h3>
21862254 and made it the [=initial value=] .
21872255 <li> Renamed <css> collapse</css> value of 'ruby-merge' to ''ruby-merge/merge'' .
21882256 (<a href="https://github.com/w3c/csswg-drafts/issues/5004">Issue 5004</a> )
2257+ <li> Defined ''visibility: collapse'' to explicitly [=hide=] an annotation
2258+ the same way [=auto-hidden=] annotations are hidden.
2259+ (<a href="https://github.com/w3c/csswg-drafts/issues/5927">Issue 5927</a> )
21892260 <li> Specified more precisely which properties apply to the various ruby display types
21902261 ([[#box-style]] )
21912262 and defined ruby, ruby base, and ruby annotation boxes
0 commit comments