CINXE.COM
Tibetan Gap Analysis
<!DOCTYPE html><html lang="en"><head> <meta charset="utf-8"> <meta name="generator" content="ReSpec 35.1.1"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <style> dfn{cursor:pointer} .dfn-panel{position:absolute;z-index:35;min-width:300px;max-width:500px;padding:.5em .75em;margin-top:.6em;font-family:"Helvetica Neue",sans-serif;font-size:small;background:#fff;background:var(--indextable-hover-bg,#fff);color:#000;color:var(--text,#000);box-shadow:0 1em 3em -.4em rgba(0,0,0,.3),0 0 1px 1px rgba(0,0,0,.05);box-shadow:0 1em 3em -.4em var(--tocsidebar-shadow,rgba(0,0,0,.3)),0 0 1px 1px var(--tocsidebar-shadow,rgba(0,0,0,.05));border-radius:2px} .dfn-panel:not(.docked)>.caret{position:absolute;top:-9px} .dfn-panel:not(.docked)>.caret::after,.dfn-panel:not(.docked)>.caret::before{content:"";position:absolute;border:10px solid transparent;border-top:0;border-bottom:10px solid #fff;border-bottom-color:var(--indextable-hover-bg,#fff);top:0} .dfn-panel:not(.docked)>.caret::before{border-bottom:9px solid #a2a9b1;border-bottom-color:var(--indextable-hover-bg,#a2a9b1)} .dfn-panel *{margin:0} .dfn-panel b{display:block;color:#000;color:var(--text,#000);margin-top:.25em} .dfn-panel ul a[href]{color:#333;color:var(--text,#333)} .dfn-panel>div{display:flex} .dfn-panel a.self-link{font-weight:700;margin-right:auto} .dfn-panel .marker{padding:.1em;margin-left:.5em;border-radius:.2em;text-align:center;white-space:nowrap;font-size:90%;color:#040b1c} .dfn-panel .marker.dfn-exported{background:#d1edfd;box-shadow:0 0 0 .125em #1ca5f940} .dfn-panel .marker.idl-block{background:#8ccbf2;box-shadow:0 0 0 .125em #0670b161} .dfn-panel a:not(:hover){text-decoration:none!important;border-bottom:none!important} .dfn-panel a[href]:hover{border-bottom-width:1px} .dfn-panel ul{padding:0} .dfn-panel li{margin-left:1em} .dfn-panel.docked{position:fixed;left:.5em;top:unset;bottom:2em;margin:0 auto;max-width:calc(100vw - .75em * 2 - .5em - .2em * 2);max-height:30vh;overflow:auto} </style> <title>Tibetan Gap Analysis</title> <style> body { font-size: 15px; } h2 { margin-left: 0; margin-top: 8em; } h3 { margin-top: 3em; } h3 a { color: #006; } h3 a:link { color: #006; } h3 a:active { color: #006; } h3 a:visited { color: #006; } h4 { margin-left: 0; font-size:1.1rem !important; color: brown; } h5 { margin-top: 1rem !important; border-block-end:1px solid #ccc !important; width:100% !important; font-style:normal !important; } .status_prompt { font-style: italic; color: #aaa; font-size: 90%; margin-bottom: 4em; } .issueLink { font-weight:bold; padding:.5rem 1rem; border-radius:.2rem; } .ok { border-left: 5em solid green; padding-left: 2em; } .ok:after { content: 'OK'; color: gray; font-weight: normal; font-size: 120%; } .okIssue { background-color: green; color:antiquewhite; } .issueLink.okIssue:visited, .issueLink.basicIssue:link { color: antiquewhite; } .na { border-left: 5em solid green; padding-left: 2em; } .na:after { content: 'Not applicable'; color: gray; font-weight: normal; font-size: 120%; } .naIssue { background-color: green; color:antiquewhite; } .issueLink.naIssue:visited, .issueLink.basicIssue:link { color: antiquewhite; } .advanced { border-left: 5em solid #0f0; padding-left: 2em; } .advanced { border-left: 5em solid moccasin; padding-left: 2em; } .advanced:after { content: 'Needs work for advanced level support.'; color: gray; font-weight: normal; font-size: 120%; } .advancedIssue { background-color: moccasin; color:chocolate; } .issueLink.advancedIssue:visited, .issueLink.basicIssue:link { color: chocolate; } .basic { border-left: 5em solid orange; padding-left: 2em; } .basic:after { content: 'Needs work for basic styling support.'; color: gray; font-weight: normal; font-size: 120%; } .basicIssue { background-color: orange; color:antiquewhite; } .issueLink.basicIssue:visited, .issueLink.basicIssue:link { color: antiquewhite; } .broken { border-left: 5em solid red; padding-left: 2em; } .broken:after { content: 'Basic display issues that prevent effective use on the Web for this language.'; color: gray; font-weight: normal; font-size: 120%; } .brokenIssue { background-color: red; color:antiquewhite; } .issueLink.brokenIssue:visited, .issueLink.basicIssue:link { color: antiquewhite; } .tbd { border-left: 5em solid #eee; padding-left: 2em; } .tbd:after { content: 'Needs research.'; color: gray; font-weight: normal; font-size: 120%; } .pass { background-color:greenyellow; padding: 0 4px; border-radius: 2px; } .fail { padding: 0 4px; color: white; background-color: crimson; border-radius: 2px; } .partial { background-color: orange; padding: 0 4px; color: white; } .reviewme:after { content: "Needs review"; margin-left: 2em; background-color: crimson; color: white; font-size: 80%; padding: .2em .4em; border-radius: .2em; } .subhead { display: block; font-weight: bold; } .ghLink { margin-block-start: 0; float: right; font-size: 90%; } .languageData { margin-block-start: -.2rem; font-style: italic; color: #aaa; font-size: 90%; margin-bottom: 4em; } .issueScore { display: none; color: #ddd; } </style> <style id="respec-mainstyle"> @keyframes pop{ 0%{transform:scale(1,1)} 25%{transform:scale(1.25,1.25);opacity:.75} 100%{transform:scale(1,1)} } a.internalDFN{color:inherit;border-bottom:1px solid #99c;text-decoration:none} a.externalDFN{color:inherit;border-bottom:1px dotted #ccc;text-decoration:none} a.bibref{text-decoration:none} .respec-offending-element:target{animation:pop .25s ease-in-out 0s 1} .respec-offending-element,a[href].respec-offending-element{text-decoration:red wavy underline} @supports not (text-decoration:red wavy underline){ .respec-offending-element:not(pre){display:inline-block} .respec-offending-element{background:url(data:image/gif;base64,R0lGODdhBAADAPEAANv///8AAP///wAAACwAAAAABAADAEACBZQjmIAFADs=) bottom repeat-x} } #references :target{background:#eaf3ff;animation:pop .4s ease-in-out 0s 1} cite .bibref{font-style:normal} a[href].orcid{padding-left:4px;padding-right:4px} a[href].orcid>svg{margin-bottom:-2px} ol.tof,ul.tof{list-style:none outside none} .caption{margin-top:.5em;font-style:italic} #issue-summary>ul{column-count:2} #issue-summary li{list-style:none;display:inline-block} details.respec-tests-details{margin-left:1em;display:inline-block;vertical-align:top} details.respec-tests-details>*{padding-right:2em} details.respec-tests-details[open]{z-index:999999;position:absolute;border:thin solid #cad3e2;border-radius:.3em;background-color:#fff;padding-bottom:.5em} details.respec-tests-details[open]>summary{border-bottom:thin solid #cad3e2;padding-left:1em;margin-bottom:1em;line-height:2em} details.respec-tests-details>ul{width:100%;margin-top:-.3em} details.respec-tests-details>li{padding-left:1em} .self-link:hover{opacity:1;text-decoration:none;background-color:transparent} aside.example .marker>a.self-link{color:inherit} .header-wrapper{display:flex;align-items:baseline} :is(h2,h3,h4,h5,h6):not(#toc>h2,#abstract>h2,#sotd>h2,.head>h2){position:relative;left:-.5em} :is(h2,h3,h4,h5,h6):not(#toch2)+a.self-link{color:inherit;order:-1;position:relative;left:-1.1em;font-size:1rem;opacity:.5} :is(h2,h3,h4,h5,h6)+a.self-link::before{content:"§";text-decoration:none;color:var(--heading-text)} :is(h2,h3)+a.self-link{top:-.2em} :is(h4,h5,h6)+a.self-link::before{color:#000} @media (max-width:767px){ dd{margin-left:0} } @media print{ .removeOnSave{display:none} } </style> <meta name="color-scheme" content="light"> <meta name="description" content="This document describes and prioritises gaps for the support of the Tibetan script on the Web and in eBooks. In particular, it is concerned with text layout. It checks that needed features are supported in W3C specifications, such as HTML and CSS and those relating to digital publications. It also checks whether the features have been implemented in browsers and ereaders."> <link rel="canonical" href="https://www.w3.org/TR/tibt-gap/"> <style> .hljs{--base:#fafafa;--mono-1:#383a42;--mono-2:#686b77;--mono-3:#717277;--hue-1:#0b76c5;--hue-2:#336ae3;--hue-3:#a626a4;--hue-4:#42803c;--hue-5:#ca4706;--hue-5-2:#c91243;--hue-6:#986801;--hue-6-2:#9a6a01} @media (prefers-color-scheme:dark){ .hljs{--base:#282c34;--mono-1:#abb2bf;--mono-2:#818896;--mono-3:#5c6370;--hue-1:#56b6c2;--hue-2:#61aeee;--hue-3:#c678dd;--hue-4:#98c379;--hue-5:#e06c75;--hue-5-2:#be5046;--hue-6:#d19a66;--hue-6-2:#e6c07b} } .hljs{display:block;overflow-x:auto;padding:.5em;color:#383a42;color:var(--mono-1,#383a42);background:#fafafa;background:var(--base,#fafafa)} .hljs-comment,.hljs-quote{color:#717277;color:var(--mono-3,#717277);font-style:italic} .hljs-doctag,.hljs-formula,.hljs-keyword{color:#a626a4;color:var(--hue-3,#a626a4)} .hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#ca4706;color:var(--hue-5,#ca4706);font-weight:700} .hljs-literal{color:#0b76c5;color:var(--hue-1,#0b76c5)} .hljs-addition,.hljs-attribute,.hljs-meta-string,.hljs-regexp,.hljs-string{color:#42803c;color:var(--hue-4,#42803c)} .hljs-built_in,.hljs-class .hljs-title{color:#9a6a01;color:var(--hue-6-2,#9a6a01)} .hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#986801;color:var(--hue-6,#986801)} .hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#336ae3;color:var(--hue-2,#336ae3)} .hljs-emphasis{font-style:italic} .hljs-strong{font-weight:700} .hljs-link{text-decoration:underline} </style> <style> var{position:relative;cursor:pointer} var[data-type]::after,var[data-type]::before{position:absolute;left:50%;top:-6px;opacity:0;transition:opacity .4s;pointer-events:none} var[data-type]::before{content:"";transform:translateX(-50%);border-width:4px 6px 0 6px;border-style:solid;border-color:transparent;border-top-color:#222} var[data-type]::after{content:attr(data-type);transform:translateX(-50%) translateY(-100%);background:#222;text-align:center;font-family:"Dank Mono","Fira Code",monospace;font-style:normal;padding:6px;border-radius:3px;color:#daca88;text-indent:0;font-weight:400} var[data-type]:hover::after,var[data-type]:hover::before{opacity:1} </style> <script id="initialUserConfig" type="application/json">{ "specStatus": "DNOTE", "noRecTrack": true, "shortName": "tibt-gap", "copyrightStart": "2018", "edDraftURI": "https://w3c.github.io/tlreq/gap-analysis/", "editors": [ { "name": "Richard Ishida", "mailto": "ishida@w3.org", "company": "W3C", "w3cid": 3439, "url": "mailto:ishida@w3.org" } ], "github": "w3c/tlreq", "group": "i18n", "preProcess": [ null, null ], "postProcess": [ null ], "langs": [ "Tibetan", "Dzongkha" ], "langTags": [ "bo", "dz" ], "gapDocPath": "https://www.w3.org/TR/tibt-gap/", "publishDate": "2024-07-10", "publishISODate": "2024-07-10T00:00:00.000Z", "generatedSubtitle": "W3C Group Draft Note 10 July 2024" }</script> <link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2021/W3C-DNOTE"></head> <body class="h-entry informative"><div class="head"> <p class="logos"><a class="logo" href="https://www.w3.org/"><img crossorigin="" alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a></p> <h1 id="title" class="title">Tibetan Gap Analysis</h1> <p id="w3c-state"><a href="https://www.w3.org/standards/types#DNOTE">W3C Group Draft Note</a> <time class="dt-published" datetime="2024-07-10">10 July 2024</time></p> <details open=""> <summary>More details about this document</summary> <dl> <dt>This version:</dt><dd> <a class="u-url" href="https://www.w3.org/TR/2024/DNOTE-tibt-gap-20240710/">https://www.w3.org/TR/2024/DNOTE-tibt-gap-20240710/</a> </dd> <dt>Latest published version:</dt><dd> <a href="https://www.w3.org/TR/tibt-gap/">https://www.w3.org/TR/tibt-gap/</a> </dd> <dt>Latest editor's draft:</dt><dd><a href="https://w3c.github.io/tlreq/gap-analysis/">https://w3c.github.io/tlreq/gap-analysis/</a></dd> <dt>History:</dt><dd> <a href="https://www.w3.org/standards/history/tibt-gap/">https://www.w3.org/standards/history/tibt-gap/</a> </dd><dd> <a href="https://github.com/w3c/tlreq/commits/">Commit history</a> </dd> <dt>Editor:</dt><dd class="editor p-author h-card vcard" data-editor-id="3439"> <a class="ed_mailto u-email email p-name" href="mailto:ishida@w3.org">Richard Ishida</a> (<span class="p-org org h-org">W3C</span>) </dd> <dt>Feedback:</dt><dd> <a href="https://github.com/w3c/tlreq/">GitHub w3c/tlreq</a> (<a href="https://github.com/w3c/tlreq/pulls/">pull requests</a>, <a href="https://github.com/w3c/tlreq/issues/new/choose">new issue</a>, <a href="https://github.com/w3c/tlreq/issues/">open issues</a>) </dd> </dl> </details> <p class="copyright"> <a href="https://www.w3.org/policies/#copyright">Copyright</a> © 2018-2024 <a href="https://www.w3.org/">World Wide Web Consortium</a>. <abbr title="World Wide Web Consortium">W3C</abbr><sup>®</sup> <a href="https://www.w3.org/policies/#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/policies/#W3C_Trademarks">trademark</a> and <a rel="license" href="https://www.w3.org/copyright/software-license-2023/" title="W3C Software and Document Notice and License">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <section id="abstract" class="introductory"><h2>Abstract</h2> <p>This document describes and prioritises gaps for the support of the Tibetan script on the Web and in eBooks. In particular, it is concerned with text layout. It checks that needed features are supported in <abbr title="World Wide Web Consortium">W3C</abbr> specifications, such as HTML and CSS and those relating to digital publications. It also checks whether the features have been implemented in browsers and ereaders.</p> </section> <div id="sotd" class="introductory"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at https://www.w3.org/TR/.</em></p> <p>This document describes and prioritises gaps for the support of the Tibetan script on the Web and in eBooks. In particular, it is concerned with text layout. It checks that needed features are supported in <abbr title="World Wide Web Consortium">W3C</abbr> specifications, in particular HTML and CSS and those relating to digital publications. It also checks whether the features have been implemented in browsers and ereaders. It is linked to from the <a href="https://www.w3.org/International/typography/gap-analysis/language-matrix.html">language matrix</a> that tracks Web support for many languages.</p> <p>The editor's draft of this document is being developed in the GitHub repository <a href="https://w3c.github.io/tlreq/home">Tibetan Language Enablement (tlreq)</a>, with contributors from the <abbr title="World Wide Web Consortium">W3C</abbr> <a href="https://www.w3.org/International/i18n-activity/i18n-ig/">Internationalization Interest Group</a>. It is published by the <a href="https://www.w3.org/International/i18n-activity/i18n-wg/">Internationalization Working Group</a>. The end target for this document is a Working Group Note.</p> <p> This document was published by the <a href="https://www.w3.org/groups/wg/i18n-core">Internationalization Working Group</a> as a Group Draft Note using the <a href="https://www.w3.org/policies/process/20231103/#recs-and-notes">Note track</a>. </p><p>Group Draft Notes are not endorsed by <abbr title="World Wide Web Consortium">W3C</abbr> nor its Members. </p><p> This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p><p data-deliverer="32113"> The <a href="https://www.w3.org/policies/patent-policy/"><abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a> does not carry any licensing requirements or commitments on this document. </p><p> This document is governed by the <a id="w3c_process_revision" href="https://www.w3.org/policies/process/20231103/">03 November 2023 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document</a>. </p></div><nav id="toc"><h2 class="introductory" id="table-of-contents">Table of Contents</h2><ol class="toc"><li class="tocline"><a class="tocxref" href="#abstract">Abstract</a></li><li class="tocline"><a class="tocxref" href="#h_introduction"><bdi class="secno">1. </bdi>Introduction</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#contributors"><bdi class="secno">1.1 </bdi>Contributors</a></li><li class="tocline"><a class="tocxref" href="#about"><bdi class="secno">1.2 </bdi>About this document</a></li><li class="tocline"><a class="tocxref" href="#prioritization"><bdi class="secno">1.3 </bdi>Prioritization</a></li><li class="tocline"><a class="tocxref" href="#related"><bdi class="secno">1.4 </bdi>Related information</a></li></ol></li><li class="tocline"><a class="tocxref" href="#direction"><bdi class="secno">2. </bdi>Text direction</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#vertical_text"><bdi class="secno">2.1 </bdi>Vertical text</a></li><li class="tocline"><a class="tocxref" href="#bidi_text"><bdi class="secno">2.2 </bdi>Bidirectional text</a></li></ol></li><li class="tocline"><a class="tocxref" href="#h_shaping"><bdi class="secno">3. </bdi>Glyph shaping & positioning</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#fonts"><bdi class="secno">3.1 </bdi>Fonts & font styles</a></li><li class="tocline"><a class="tocxref" href="#glyphs"><bdi class="secno">3.2 </bdi>Context-based shaping and positioning</a></li><li class="tocline"><a class="tocxref" href="#letterforms"><bdi class="secno">3.3 </bdi>Letterform slopes, weights, & italics</a></li><li class="tocline"><a class="tocxref" href="#cursive"><bdi class="secno">3.4 </bdi>Cursive text</a></li><li class="tocline"><a class="tocxref" href="#transforms"><bdi class="secno">3.5 </bdi>Case & other character transforms</a></li></ol></li><li class="tocline"><a class="tocxref" href="#h_units"><bdi class="secno">4. </bdi>Typographic units</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#encoding"><bdi class="secno">4.1 </bdi>Characters & encoding</a></li><li class="tocline"><a class="tocxref" href="#segmentation"><bdi class="secno">4.2 </bdi>Grapheme/word segmentation & selection</a></li></ol></li><li class="tocline"><a class="tocxref" href="#h_inline"><bdi class="secno">5. </bdi>Punctuation & inline features</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#punctuation_etc"><bdi class="secno">5.1 </bdi>Phrase & section boundaries</a></li><li class="tocline"><a class="tocxref" href="#quotations"><bdi class="secno">5.2 </bdi>Quotations & citations</a></li><li class="tocline"><a class="tocxref" href="#emphasis"><bdi class="secno">5.3 </bdi>Emphasis & highlighting</a></li><li class="tocline"><a class="tocxref" href="#abbrev"><bdi class="secno">5.4 </bdi>Abbreviation, ellipsis & repetition</a></li><li class="tocline"><a class="tocxref" href="#inline_notes"><bdi class="secno">5.5 </bdi>Inline notes & annotations</a></li><li class="tocline"><a class="tocxref" href="#text_decoration"><bdi class="secno">5.6 </bdi>Text decoration & other inline features</a></li><li class="tocline"><a class="tocxref" href="#data_formats"><bdi class="secno">5.7 </bdi>Data formats & numbers</a></li></ol></li><li class="tocline"><a class="tocxref" href="#h_lines_and_paragraphs"><bdi class="secno">6. </bdi>Line and paragraph layout</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#line_breaking"><bdi class="secno">6.1 </bdi>Line breaking & hyphenation</a></li><li class="tocline"><a class="tocxref" href="#justification"><bdi class="secno">6.2 </bdi>Text alignment & justification</a></li><li class="tocline"><a class="tocxref" href="#spacing"><bdi class="secno">6.3 </bdi>Text spacing</a></li><li class="tocline"><a class="tocxref" href="#baselines"><bdi class="secno">6.4 </bdi>Baselines, line-height, etc</a></li><li class="tocline"><a class="tocxref" href="#lists"><bdi class="secno">6.5 </bdi>Lists, counters, etc.</a></li><li class="tocline"><a class="tocxref" href="#initials"><bdi class="secno">6.6 </bdi>Styling initials</a></li></ol></li><li class="tocline"><a class="tocxref" href="#h_pages"><bdi class="secno">7. </bdi>Page & book layout</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#page_layout"><bdi class="secno">7.1 </bdi>General page layout & progression</a></li><li class="tocline"><a class="tocxref" href="#grids_tables"><bdi class="secno">7.2 </bdi>Grids & tables</a></li><li class="tocline"><a class="tocxref" href="#footnotes_etc"><bdi class="secno">7.3 </bdi>Footnotes, endnotes, etc.</a></li><li class="tocline"><a class="tocxref" href="#headers_footers"><bdi class="secno">7.4 </bdi>Page headers, footers, etc.</a></li><li class="tocline"><a class="tocxref" href="#interaction"><bdi class="secno">7.5 </bdi>Forms & user interaction</a></li></ol></li><li class="tocline"><a class="tocxref" href="#h_other"><bdi class="secno">8. </bdi>Other</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#culturespecific"><bdi class="secno">8.1 </bdi>Culture-specific features</a></li><li class="tocline"><a class="tocxref" href="#other"><bdi class="secno">8.2 </bdi>What else?</a></li></ol></li></ol></nav> <section id="h_introduction"><div class="header-wrapper"><h2 id="x1-introduction"><bdi class="secno">1. </bdi>Introduction</h2><a class="self-link" href="#h_introduction" aria-label="Permalink for Section 1."></a></div> <section id="contributors"><div class="header-wrapper"><h3 id="x1-1-contributors"><bdi class="secno">1.1 </bdi>Contributors</h3><a class="self-link" href="#contributors" aria-label="Permalink for Section 1.1"></a></div> <p>This document was created by Richard Ishida.</p> <p data-lang="en">See also the <a href="https://github.com/w3c/tlreq/graphs/contributors">GitHub contributors list</a> for the Tibetan Language Enablement project, and the <a href="https://github.com/w3c/tlreq/issues?q=is%3Aissue+label%3As%3Atlreq">discussions related to the Tibetan script</a>.</p> </section> <section id="about"><div class="header-wrapper"><h3 id="x1-2-about-this-document"><bdi class="secno">1.2 </bdi>About this document</h3><a class="self-link" href="#about" aria-label="Permalink for Section 1.2"></a></div> <p>The <abbr title="World Wide Web Consortium">W3C</abbr> needs to make sure that the needs of scripts and languages around the world are built in to technologies such as HTML, CSS, SVG, etc. so that Web pages and eBooks can look and behave as people expect around the world.</p> <p>This page documents difficulties that people encounter when trying to use languages written in the Tibetan script on the Web.</p> <p>Having identified an issue, it investigates the current status with regards to web specifications and implementations by user agents (browsers, e-readers, etc.), and attempts to prioritise the severity of the issue for web users.</p> </section> <section id="prioritization"><div class="header-wrapper"><h3 id="x1-3-prioritization"><bdi class="secno">1.3 </bdi>Prioritization</h3><a class="self-link" href="#prioritization" aria-label="Permalink for Section 1.3"></a></div> <p>This document not only describes gaps, it also attempts to prioritise them in terms of the impact on the local user. The prioritisation is indicated by colour.</p> <p>Key:</p> <ul style="list-style-type: none;"> <li class="ok"></li> <li class="na"></li> <li class="advanced"></li> <li class="basic"></li> <li class="broken"></li> <li class="tbd"></li> </ul> <p>It is important to note that these colours do not indicate to what extent a particular feature is broken. They indicate the impact of a broken or missing feature on the content author or end user.</p> <p>Basic styling is the level that would be generally accepted as sufficient for most Web pages. Advanced level support would include additional features one might expect to include in ebooks or other advanced typographic formats. There may be features of a script or language that are not supported on the Web, but that are not generally regarded as necessary (usually archaic or obscure features). In this case, the feature can be described here, but the status should be marked as OK.</p> <p>The decision as to what priority level is assigned to a described gap is down to the experts doing the gap analysis. It may not always be straightforward to decide. If a given section in this document refers to more than one feature that is broken, each with different impacts on Web users, the priority for the section should be the lowest denominator.</p> <p>A cell can be scored as OK if the feature in question is specified in an appropriate specification, and is supported by user agents. A specification that is in CR or later and has two implementations in 'major' browsers will count. This means that the feature may not be supported in all browsers yet. (At some point in the future we may try to distinguish, visually, whether support is available in a specification but still pending in major browsers or applications.) </p> </section> <section id="related"><div class="header-wrapper"><h3 id="x1-4-related-information"><bdi class="secno">1.4 </bdi>Related information</h3><a class="self-link" href="#related" aria-label="Permalink for Section 1.4"></a></div> <p>A summary of this report and others can be found as part of the <a href="https://www.w3.org/International/typography/gap-analysis/language-matrix.html" target="_blank">Language Matrix</a>.</p> <p>Gap reports are brought to the attention of spec and browser implementers, and are tracked via the <a href="https://github.com/orgs/w3c/projects/95" target="_blank">Gap Analysis Pipeline</a>. (<a href="https://github.com/orgs/w3c/projects/95/views/1?filterQuery=label%3A%22s%3Atlreq%22" target="_blank">Filter for Tibetan script items</a>)</p> <p>See also <a href="https://www.w3.org/TR/tlreq-lreq/" target="_blank">Tibetan Script Resources</a> for information about the Tibetan script.</p> </section> </section> <section id="direction"><div class="header-wrapper"><h2 id="x2-text-direction"><bdi class="secno">2. </bdi>Text direction</h2><a class="self-link" href="#direction" aria-label="Permalink for Section 2."></a></div> <p>See also General page layout & progression for features such as column layout, page turning direction, etc. that are affected by text direction.</p> <section id="vertical_text" class="tbd"><div class="header-wrapper"><h3 id="x2-1-vertical-text"><bdi class="secno">2.1 </bdi>Vertical text</h3><a class="self-link" href="#vertical_text" aria-label="Permalink for Section 2.1"></a></div> <p id="prompt-vertical_text" class="status_prompt promptStub">Are the script requirements for vertically oriented text met? What about if you mix vertical text with scripts that are normally only horizontal? Do you need a switch to use different characters in vertical vs. horizontal text? Does the browser support short runs of horizontal text in vertical lines (tate-chu-yoko in Japanese) as expected? Is the orientation of characters and the directional ordering of characters supported as needed?</p> <div id="insert-vertical_text"></div> </section> <section id="bidi_text" class="na"><div class="header-wrapper"><h3 id="x2-2-bidirectional-text"><bdi class="secno">2.2 </bdi>Bidirectional text</h3><a class="self-link" href="#bidi_text" aria-label="Permalink for Section 2.2"></a></div> <p id="prompt-bidi_text" class="status_prompt promptStub">If this script runs right-to-left, are there any issues when handling that? Is bidirectional text adequately supported? What about numbers and expressions? Do the Unicode bidi controls and HTML markup provide the support needed? Is isolation of directional runs problematic?</p> <div id="insert-bidi_text"></div> </section> </section> <section id="h_shaping"><div class="header-wrapper"><h2 id="x3-glyph-shaping-positioning"><bdi class="secno">3. </bdi>Glyph shaping & positioning</h2><a class="self-link" href="#h_shaping" aria-label="Permalink for Section 3."></a></div> <section id="fonts" class="ok"><div class="header-wrapper"><h3 id="x3-1-fonts-font-styles"><bdi class="secno">3.1 </bdi>Fonts & font styles</h3><a class="self-link" href="#fonts" aria-label="Permalink for Section 3.1"></a></div> <p id="prompt-fonts" class="status_prompt promptStub">Do the standard fallback fonts used in browsers (eg. serif, sans-serif, cursive, etc.) match expectations? Are special font or OpenType features needed for this script that are not available?</p> <div id="insert-fonts"></div> </section> <section id="glyphs" class="tbd"><div class="header-wrapper"><h3 id="x3-2-context-based-shaping-and-positioning"><bdi class="secno">3.2 </bdi>Context-based shaping and positioning</h3><a class="self-link" href="#glyphs" aria-label="Permalink for Section 3.2"></a></div> <p id="prompt-glyphs" class="status_prompt promptStub">Does the script in question require additional user control features to support alterations to the position or shape of glyphs, for example adjusting the distance between the base text and diacritics, or changing the glyphs used in a systematic way? Do you need to be able to compose/decompose conjuncts, or show characters that are otherwise hidden, etc?</p> <div id="insert-glyphs"></div> </section> <section id="letterforms" class="tbd"><div class="header-wrapper"><h3 id="x3-3-letterform-slopes-weights-italics"><bdi class="secno">3.3 </bdi>Letterform slopes, weights, & italics</h3><a class="self-link" href="#letterforms" aria-label="Permalink for Section 3.3"></a></div> <p id="prompt-letterforms" class="status_prompt promptStub">This covers ways of modifying the glyphs, such as for italicisation, bolding, oblique, etc. Do italic fonts lean in the right direction? Is synthesised italicisation problematic? Are there other problems relating to bolding or italicisation - perhaps relating to generalised assumptions of applicability?</p> <div id="insert-letterforms"></div> </section> <section id="cursive" class="na"><div class="header-wrapper"><h3 id="x3-4-cursive-text"><bdi class="secno">3.4 </bdi>Cursive text</h3><a class="self-link" href="#cursive" aria-label="Permalink for Section 3.4"></a></div> <p id="prompt-cursive" class="status_prompt promptStub">If this script is cursive (eg. Arabic, N’Ko, Syriac, etc), are there problems or needed features related to the handling of cursive text? Do cursive links break if parts of a word are marked up or styled? Do Unicode joiner and non-joiner characters behave as expected?</p> <div id="insert-cursive"></div> </section> <section id="transforms" class="na"><div class="header-wrapper"><h3 id="x3-5-case-other-character-transforms"><bdi class="secno">3.5 </bdi>Case & other character transforms</h3><a class="self-link" href="#transforms" aria-label="Permalink for Section 3.5"></a></div> <p id="prompt-transforms" class="status_prompt promptStub">Does your script need special text transforms that are not supported? Does your script convert letters to uppercase, capitalised and lowercase alternatives according to your typographic needs? Do you need to to convert between half-width and full-width presentation forms?</p> <div id="insert-transforms"></div> </section> </section> <section id="h_units"><div class="header-wrapper"><h2 id="x4-typographic-units"><bdi class="secno">4. </bdi>Typographic units</h2><a class="self-link" href="#h_units" aria-label="Permalink for Section 4."></a></div> <section id="encoding" class="ok"><div class="header-wrapper"><h3 id="x4-1-characters-encoding"><bdi class="secno">4.1 </bdi>Characters & encoding</h3><a class="self-link" href="#encoding" aria-label="Permalink for Section 4.1"></a></div> <p id="prompt-encoding" class="status_prompt promptStub">Are there any character repertoire issues preventing use of this script on the Web? Do variation selectors need attention? Are there any other encoding-related issues?</p> <div id="insert-encoding"></div> </section> <section id="segmentation" class="tbd"><div class="header-wrapper"><h3 id="x4-2-grapheme-word-segmentation-selection"><bdi class="secno">4.2 </bdi>Grapheme/word segmentation & selection</h3><a class="self-link" href="#segmentation" aria-label="Permalink for Section 4.2"></a></div> <p id="prompt-segmentation" class="status_prompt promptStub">This is about how text is divided into graphemes, words, sentences, etc., and behaviour associated with that. Do Unicode grapheme clusters appropriately segment character units for your script? When you double- or triple-click on the text, is the expected range of characters highlighted? When you move through the text with the cursor, or backspace, etc. do you see the expected behaviour? (Some of the answers to these questions may be picker up in other sections, such as line-breaking, or initial-letter styling.)</p> <div id="insert-segmentation"></div> </section> </section> <section id="h_inline"><div class="header-wrapper"><h2 id="x5-punctuation-inline-features"><bdi class="secno">5. </bdi>Punctuation & inline features</h2><a class="self-link" href="#h_inline" aria-label="Permalink for Section 5."></a></div> <section id="punctuation_etc" class="tbd"><div class="header-wrapper"><h3 id="x5-1-phrase-section-boundaries"><bdi class="secno">5.1 </bdi>Phrase & section boundaries</h3><a class="self-link" href="#punctuation_etc" aria-label="Permalink for Section 5.1"></a></div> <p id="prompt-punctuation_etc" class="status_prompt promptStub">Are there specific problems related to punctuation or the interaction of the text with punctuation (for example separation of punctuation from previous text, but allowing no line break between)? Are there issues related to handling of abbreviation, ellipsis, or iteration? Are there problems related to bracketing information or demarcating things such as proper nouns, etc?</p> <div id="insert-punctuation_etc"></div> </section> <section id="quotations" class="tbd"><div class="header-wrapper"><h3 id="x5-2-quotations-citations"><bdi class="secno">5.2 </bdi>Quotations & citations</h3><a class="self-link" href="#quotations" aria-label="Permalink for Section 5.2"></a></div> <p id="prompt-quotations" class="status_prompt promptStub">Are there any issues when dealing with quotations marks, especially when nested? Should block quotes be indented or handled specially?</p> <div id="insert-quotations"></div> </section> <section id="emphasis" class="tbd"><div class="header-wrapper"><h3 id="x5-3-emphasis-highlighting"><bdi class="secno">5.3 </bdi>Emphasis & highlighting</h3><a class="self-link" href="#emphasis" aria-label="Permalink for Section 5.3"></a></div> <p id="prompt-emphasis" class="status_prompt promptStub">How are emphasis and highlighting achieved? If lines or marks are drawn alongside, over or through the text, do they need to be a special distance from the text itself? Is it important to skip characters when underlining, etc? How do things change for vertically set text?</p> <div id="insert-emphasis"></div> </section> <section id="abbrev" class="tbd"><div class="header-wrapper"><h3 id="x5-4-abbreviation-ellipsis-repetition"><bdi class="secno">5.4 </bdi>Abbreviation, ellipsis & repetition</h3><a class="self-link" href="#abbrev" aria-label="Permalink for Section 5.4"></a></div> <p id="prompt-abbrev" class="status_prompt promptStub">What characters or other methods are used to indicate abbreviation, ellipsis & repetition?</p> <div id="insert-abbrev"></div> </section> <section id="inline_notes" class="tbd"><div class="header-wrapper"><h3 id="x5-5-inline-notes-annotations"><bdi class="secno">5.5 </bdi>Inline notes & annotations</h3><a class="self-link" href="#inline_notes" aria-label="Permalink for Section 5.5"></a></div> <p id="prompt-inline_notes" class="status_prompt promptStub">The ruby spec currently specifies an initial subset of requirements for fine-tuning the typography of phonetic and semantic annotations of East Asian text, including furigana, pinyin and zhuyin fuhao systems. Is is adequate for what it sets out to do? What other controls will be needed in the future? What about other types of inline annotation, such as warichu? (For referent-type notes such as footnotes, see below.)</p> <div id="insert-inline_notes"></div> </section> <section id="text_decoration" class="tbd"><div class="header-wrapper"><h3 id="x5-6-text-decoration-other-inline-features"><bdi class="secno">5.6 </bdi>Text decoration & other inline features</h3><a class="self-link" href="#text_decoration" aria-label="Permalink for Section 5.6"></a></div> <p id="prompt-text_decoration" class="status_prompt promptStub">This is about ways of marking text (see also specific sections dedicated to quotations and inline notes/annotations). Is it possible to express emphasis or highlight content as expected? Bold, italic and under-/over-lines are not always appropriate, and some scripts have their own unique ways of doing things, that are not in the Western tradition at all. Text delimiters mark certain items or sections off from the main text, such as book names in Chinese, quotations, head markers in Tibetan, etc, and often involve the use of punctuation. Is there any behaviour that isn't well supported, such as overlines for numeric digits in Syriac? Are there issues about the positioning or use of underlines? Some aspects related to the drawing of lines alongside or through text involve local typographic considerations. Do underlines need to be broken in special ways for this script? Do you need support for additional line shapes or widths? Does the distance or position of the lines relative to the text need to vary in ways that are not achievable? Are lines correctly drawn relative to vertical text? </p> <div id="insert-text_decoration"></div> </section> <section id="data_formats" class="tbd"><div class="header-wrapper"><h3 id="x5-7-data-formats-numbers"><bdi class="secno">5.7 </bdi>Data formats & numbers</h3><a class="self-link" href="#data_formats" aria-label="Permalink for Section 5.7"></a></div> <p id="prompt-data_formats" class="status_prompt promptStub">If the script has its own set of number digits, are there any issues in how they are used? Does the script or language use special format patterns that are problematic (eg. 12,34,000 in India)? What about date/time formats and selection - and are non-Gregorian calendars needed? Do percent signs and other symbols associated with number work correctly, and do numbers need special decorations, (like in Ethiopic or Syriac)? How about the management of personal names, addresses, etc. in web pages: are there issues?</p> <div id="insert-data_formats"></div> </section> </section> <section id="h_lines_and_paragraphs"><div class="header-wrapper"><h2 id="x6-line-and-paragraph-layout"><bdi class="secno">6. </bdi>Line and paragraph layout</h2><a class="self-link" href="#h_lines_and_paragraphs" aria-label="Permalink for Section 6."></a></div> <section id="line_breaking" class="tbd"><div class="header-wrapper"><h3 id="x6-1-line-breaking-hyphenation"><bdi class="secno">6.1 </bdi>Line breaking & hyphenation</h3><a class="self-link" href="#line_breaking" aria-label="Permalink for Section 6.1"></a></div> <p id="prompt-line_breaking" class="status_prompt promptStub">Does the browser capture the rules about the way text in your script wraps when it hits the end of a line? Does line-breaking wrap whole 'words' at a time, or characters, or something else (such as syllables in Tibetan and Javanese)? What characters should not appear at the end or start of a line, and what should be done to prevent that?</p> <div id="insert-line_breaking"></div> </section> <section id="justification" class="tbd"><div class="header-wrapper"><h3 id="x6-2-text-alignment-justification"><bdi class="secno">6.2 </bdi>Text alignment & justification</h3><a class="self-link" href="#justification" aria-label="Permalink for Section 6.2"></a></div> <p id="prompt-justification" class="status_prompt promptStub">When text in a paragraph needs to have flush lines down both sides, does it follow the rules for your script? Does the script need assistance to conform to a grid pattern? Does your script allow punctuation to hang outside the text box at the start or end of a line? Where adjustments are need to make a line flush, how is that done? Do you shrink/stretch space between words and/or letters? Are word baselines stretched, as in Arabic? What about paragraph indents, or the need for logical alignment keywords, such as start/end, rather than left/right?</p> <div id="insert-justification"></div> </section> <section id="spacing" class="tbd"><div class="header-wrapper"><h3 id="x6-3-text-spacing"><bdi class="secno">6.3 </bdi>Text spacing</h3><a class="self-link" href="#spacing" aria-label="Permalink for Section 6.3"></a></div> <p id="prompt-spacing" class="status_prompt promptStub">Some scripts create emphasis or other effects by spacing out the words, letters or syllables in a word. Are there requirements for this script/language that are unsupported? (For justification related spacing, see below.)</p> <div id="insert-spacing"></div> </section> <section id="baselines" class="ok"><div class="header-wrapper"><h3 id="x6-4-baselines-line-height-etc"><bdi class="secno">6.4 </bdi>Baselines, line-height, etc</h3><a class="self-link" href="#baselines" aria-label="Permalink for Section 6.4"></a></div> <p id="prompt-baselines" class="status_prompt promptStub">Does the browser support requirements for baseline alignment between mixed scripts and in general?</p> <div id="insert-baselines"></div> </section> <section id="lists" class="ok"><div class="header-wrapper"><h3 id="x6-5-lists-counters-etc"><bdi class="secno">6.5 </bdi>Lists, counters, etc.</h3><a class="self-link" href="#lists" aria-label="Permalink for Section 6.5"></a></div> <p id="prompt-lists" class="status_prompt promptStub">The CSS Counter Styles specification describes a limited set of simple and complex styles for counters to be used in list numbering, chapter heading numbering, etc.The rules plus more counter styles (totalling around 120 for over 30 scripts) are listed in the document <a href="https://www.w3.org/TR/predefined-counter-styles/">Ready-made Counter Styles</a>. Do these cover your needs? Are the details correct? Are there other aspects related to counters and lists that need to be addressed?</p> <div id="insert-lists"></div> </section> <section id="initials" class="tbd"><div class="header-wrapper"><h3 id="x6-6-styling-initials"><bdi class="secno">6.6 </bdi>Styling initials</h3><a class="self-link" href="#initials" aria-label="Permalink for Section 6.6"></a></div> <p id="prompt-initials" class="status_prompt promptStub">Does the browser or ereader correctly handle special styling of the initial letter of a line or paragraph, such as for drop caps or similar? How about the size relationship between the large letter and the lines alongide? where does the large letter anchor relative to the lines alongside? is it normal to include initial quote marks in the large letter? is the large letter really a syllable? etc. Are all of these things working as expected?</p> <div id="insert-initials"></div> </section> </section> <section id="h_pages"><div class="header-wrapper"><h2 id="x7-page-book-layout"><bdi class="secno">7. </bdi>Page & book layout</h2><a class="self-link" href="#h_pages" aria-label="Permalink for Section 7."></a></div> <section id="page_layout" class="ok"><div class="header-wrapper"><h3 id="x7-1-general-page-layout-progression"><bdi class="secno">7.1 </bdi>General page layout & progression</h3><a class="self-link" href="#page_layout" aria-label="Permalink for Section 7.1"></a></div> <p id="prompt-page_layout" class="status_prompt promptStub">How are the main text area and ancilliary areas positioned and defined? Are there any special requirements here, such as dimensions in characters for the Japanese kihon hanmen? The book cover for scripts that are read right-to-left scripts is on the right of the spine, rather than the left. Is that provided for? When content can flow vertically and to the left or right, how do you specify the location of objects, text, etc. relative to the flow? For example, keywords 'left' and 'right' are likely to need to be reversed for pages written in English and page written in Arabic. Do tables and grid layouts work as expected? How do columns work in vertical text? Can you mix block of vertical and horizontal text correctly? Does text scroll in the expected direction? Other topics that belong here include any local requirements for things such as printer marks, tables of contents and indexes.</p> <div id="insert-page-layout"></div> </section> <section id="grids_tables" class="ok"><div class="header-wrapper"><h3 id="x7-2-grids-tables"><bdi class="secno">7.2 </bdi>Grids & tables</h3><a class="self-link" href="#grids_tables" aria-label="Permalink for Section 7.2"></a></div> <p id="prompt-grids_tables" class="status_prompt promptStub">Does the script have special requirements for character grids or tables?</p> <div id="insert-grids_tables"></div> </section> <section id="footnotes_etc" class="ok"><div class="header-wrapper"><h3 id="x7-3-footnotes-endnotes-etc"><bdi class="secno">7.3 </bdi>Footnotes, endnotes, etc.</h3><a class="self-link" href="#footnotes_etc" aria-label="Permalink for Section 7.3"></a></div> <p id="prompt-footnotes_etc" class="status_prompt promptStub">Does your script have special requirements for footnotes, endnotes or other necessary annotations of this kind in the way needed for your culture? (There is a section above for purely inline annotations, such as ruby or warichu. This section is more about annotation systems that separate the reference marks and the content of the notes.)</p> <div id="insert-footnotes_etc"></div> </section> <section id="headers_footers" class="ok"><div class="header-wrapper"><h3 id="x7-4-page-headers-footers-etc"><bdi class="secno">7.4 </bdi>Page headers, footers, etc.</h3><a class="self-link" href="#headers_footers" aria-label="Permalink for Section 7.4"></a></div> <p id="prompt-headers_footers" class="status_prompt promptStub">Are there special conventions for page numbering, or the way that running headers and the like are handled?</p> <div id="insert-headers_footers"></div> </section> <section id="interaction" class="ok"><div class="header-wrapper"><h3 id="x7-5-forms-user-interaction"><bdi class="secno">7.5 </bdi>Forms & user interaction</h3><a class="self-link" href="#interaction" aria-label="Permalink for Section 7.5"></a></div> <p id="prompt-interaction" class="status_prompt promptStub">Are vertical form controls well supported? In right-to-left scripts, is it possible to set the base direction for a form field? Is the scroll bar on the correct side? etc.</p> <div id="insert-interaction"></div> </section> </section> <section id="h_other"><div class="header-wrapper"><h2 id="x8-other"><bdi class="secno">8. </bdi>Other</h2><a class="self-link" href="#h_other" aria-label="Permalink for Section 8."></a></div> <section id="culturespecific" class="tbd"><div class="header-wrapper"><h3 id="x8-1-culture-specific-features"><bdi class="secno">8.1 </bdi>Culture-specific features</h3><a class="self-link" href="#culturespecific" aria-label="Permalink for Section 8.1"></a></div> <p class="status_prompt">Sometimes a script or language does things that are not common outside of its sphere of influence. This is a loose bag of additional items that weren't previously mentioned. This section may also be relevant for observations related to locale formats (such as number, date, currency, format support).</p> <div id="insert-culturespecific"></div> </section> <section id="other" class="tbd"><div class="header-wrapper"><h3 id="x8-2-what-else"><bdi class="secno">8.2 </bdi>What else?</h3><a class="self-link" href="#other" aria-label="Permalink for Section 8.2"></a></div> <p class="status_prompt">There are many other CSS modules which may need review for script-specific requirements, not to mention the SVG, HTML, Speech, MathML and other specifications. What else is likely to cause problems for worldwide deployment of the Web, and what requirements need to be addressed to make the Web function well locally?</p> <div id="insert-other"></div> </section> </section> <details id="summaryStats"> <summary style="margin-top:4em; cursor: pointer;" onclick="setUpSummary(); printSummary(true)">Show summary</summary> <pre id="summaryPlaceholder" style="white-space: pre-wrap;"></pre> </details> <script> if (window.location.href.includes('/TR/')) document.getElementById('summaryStats').style.display = 'none' </script> <p role="navigation" id="back-to-top"> <a href="#title"><abbr title="Back to Top">↑</abbr></a> </p><script id="respec-dfn-panel">(() => { // @ts-check if (document.respec) { document.respec.ready.then(setupPanel); } else { setupPanel(); } function setupPanel() { const listener = panelListener(); document.body.addEventListener("keydown", listener); document.body.addEventListener("click", listener); } function panelListener() { /** @type {HTMLElement} */ let panel = null; return event => { const { target, type } = event; if (!(target instanceof HTMLElement)) return; // For keys, we only care about Enter key to activate the panel // otherwise it's activated via a click. if (type === "keydown" && event.key !== "Enter") return; const action = deriveAction(event); switch (action) { case "show": { hidePanel(panel); /** @type {HTMLElement} */ const dfn = target.closest("dfn, .index-term"); panel = document.getElementById(`dfn-panel-for-${dfn.id}`); const coords = deriveCoordinates(event); displayPanel(dfn, panel, coords); break; } case "dock": { panel.style.left = null; panel.style.top = null; panel.classList.add("docked"); break; } case "hide": { hidePanel(panel); panel = null; break; } } }; } /** * @param {MouseEvent|KeyboardEvent} event */ function deriveCoordinates(event) { const target = /** @type HTMLElement */ (event.target); // We prevent synthetic AT clicks from putting // the dialog in a weird place. The AT events sometimes // lack coordinates, so they have clientX/Y = 0 const rect = target.getBoundingClientRect(); if ( event instanceof MouseEvent && event.clientX >= rect.left && event.clientY >= rect.top ) { // The event probably happened inside the bounding rect... return { x: event.clientX, y: event.clientY }; } // Offset to the middle of the element const x = rect.x + rect.width / 2; // Placed at the bottom of the element const y = rect.y + rect.height; return { x, y }; } /** * @param {Event} event */ function deriveAction(event) { const target = /** @type {HTMLElement} */ (event.target); const hitALink = !!target.closest("a"); if (target.closest("dfn:not([data-cite]), .index-term")) { return hitALink ? "none" : "show"; } if (target.closest(".dfn-panel")) { if (hitALink) { return target.classList.contains("self-link") ? "hide" : "dock"; } const panel = target.closest(".dfn-panel"); return panel.classList.contains("docked") ? "hide" : "none"; } if (document.querySelector(".dfn-panel:not([hidden])")) { return "hide"; } return "none"; } /** * @param {HTMLElement} dfn * @param {HTMLElement} panel * @param {{ x: number, y: number }} clickPosition */ function displayPanel(dfn, panel, { x, y }) { panel.hidden = false; // distance (px) between edge of panel and the pointing triangle (caret) const MARGIN = 20; const dfnRects = dfn.getClientRects(); // Find the `top` offset when the `dfn` can be spread across multiple lines let closestTop = 0; let minDiff = Infinity; for (const rect of dfnRects) { const { top, bottom } = rect; const diffFromClickY = Math.abs((top + bottom) / 2 - y); if (diffFromClickY < minDiff) { minDiff = diffFromClickY; closestTop = top; } } const top = window.scrollY + closestTop + dfnRects[0].height; const left = x - MARGIN; panel.style.left = `${left}px`; panel.style.top = `${top}px`; // Find if the panel is flowing out of the window const panelRect = panel.getBoundingClientRect(); const SCREEN_WIDTH = Math.min(window.innerWidth, window.screen.width); if (panelRect.right > SCREEN_WIDTH) { const newLeft = Math.max(MARGIN, x + MARGIN - panelRect.width); const newCaretOffset = left - newLeft; panel.style.left = `${newLeft}px`; /** @type {HTMLElement} */ const caret = panel.querySelector(".caret"); caret.style.left = `${newCaretOffset}px`; } // As it's a dialog, we trap focus. // TODO: when <dialog> becomes a implemented, we should really // use that. trapFocus(panel, dfn); } /** * @param {HTMLElement} panel * @param {HTMLElement} dfn * @returns */ function trapFocus(panel, dfn) { /** @type NodeListOf<HTMLAnchorElement> elements */ const anchors = panel.querySelectorAll("a[href]"); // No need to trap focus if (!anchors.length) return; // Move focus to first anchor element const first = anchors.item(0); first.focus(); const trapListener = createTrapListener(anchors, panel, dfn); panel.addEventListener("keydown", trapListener); // Hiding the panel releases the trap const mo = new MutationObserver(records => { const [record] = records; const target = /** @type HTMLElement */ (record.target); if (target.hidden) { panel.removeEventListener("keydown", trapListener); mo.disconnect(); } }); mo.observe(panel, { attributes: true, attributeFilter: ["hidden"] }); } /** * * @param {NodeListOf<HTMLAnchorElement>} anchors * @param {HTMLElement} panel * @param {HTMLElement} dfn * @returns */ function createTrapListener(anchors, panel, dfn) { const lastIndex = anchors.length - 1; let currentIndex = 0; return event => { switch (event.key) { // Hitting "Tab" traps us in a nice loop around elements. case "Tab": { event.preventDefault(); currentIndex += event.shiftKey ? -1 : +1; if (currentIndex < 0) { currentIndex = lastIndex; } else if (currentIndex > lastIndex) { currentIndex = 0; } anchors.item(currentIndex).focus(); break; } // Hitting "Enter" on an anchor releases the trap. case "Enter": hidePanel(panel); break; // Hitting "Escape" returns focus to dfn. case "Escape": hidePanel(panel); dfn.focus(); return; } }; } /** @param {HTMLElement} panel */ function hidePanel(panel) { if (!panel) return; panel.hidden = true; panel.classList.remove("docked"); } })()</script><script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script></body></html>