SlideShare a Scribd company logo
1 of 35
CSS Display Properties
versus
HTML Semantics
• I’ve written some stuff,
• Member of W3C,
• Building for the web
since 1993,
• Learn more at
AdrianRoselli.com,
• Avoid on Twitter @aardrian.
About Adrian Roselli
CSS Display Properties
• The following can override native semantics in the browser:
• display: block
• display: inline
• display: grid
• display: flex
• display: contents
CSS Display Properties
• Nothing in the HTML / CSS specifications mandates this,
• Does not work in reverse:
• display: table
• display: table-cell
Assistive Technology (AT)
• Browsers do not convey correct semantics to AT,
• Users who rely on these semantics can be stranded:
• Understanding content,
• Navigating a page.
Tables as a Canary
• Breaking semantics of any single required child element can
break entire table:
• A missing row, column or row header;
• The parent table even with good rows and cells.
Accessibility Tree
• A sub/super-set of the DOM,
• Includes UI objects of browser & objects of the document,
• Created in tree for every DOM element that:
• Fires an accessibility event,
• Has a property, relationship or feature which needs to be exposed.
• Is abstracted for dev tools.
Accessibility Tree: <table>
Accessibility Tree: <caption>
Accessibility Tree: <th>
Accessibility Tree: <td>
Chrome 86 / Windows 10
CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button>
display: flex ✔ ✔ ✔ ✔
display: grid ✔ ✔ ✔ ✔
display: block ✔ ✔ ✔ ✔
display: inline-block ✔ ✔ ✔ ✔
display: contents ✔ ❌ ✔ ✔
Firefox 82 / Windows 10
CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button>
display: flex ❌1 ✔ ✔ ✔
display: grid ❌1 ✔ ✔ ✔
display: block ✔ ✔ ✔ ✔
display: inline-block ✔ ✔2 ✔ ✔
display: contents ✔ ✔2 ✔ ✔3
Safari / macOS 10.15.6
CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button>
display: flex ❌1 ✔4 ✔ ✔
display: grid ❌1 ✔4 ✔ ✔
display: block ❌2 ❌ ✔ ✔
display: inline-block ❌2 ❌ ✔ ✔
display: contents ❌3 ❌ ❌ ❌
Chrome 86 / Android 11
CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button>
display: flex ✔ ✔ ✔ ✔
display: grid ✔ ✔ ✔ ✔
display: block ✔ ✔ ✔ ✔
display: inline-block ✔ ✔ ✔ ✔
display: contents ✔ ❌1 ✔ ✔
Safari / iOS 14
CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button>
display: flex ❌ ✔ ✔ ✔
display: grid ❌ ✔ ✔ ✔
display: block ❌1 ❌2 ✔ ✔
display: inline-block ❌1 ❌2 ✔ ✔
display: contents ❌1 ❌2 ❌ ❌3
display: table
• display: table, table-caption, table-row, table-cell;
• Each of these will add layout-table semantics in Chrome v80+,
• There is no CSS display property for col/row headers,
• Requires a well-structured DOM,
• Not a workaround, fix, or way to do <div>s-as-tables.
display: table
• As LayoutTable, LayoutRowTable, LayoutCellTable;
• JAWS, Narrator will read this as a table,
– But without col/row headers,
• NVDA, VO, TalkBack will not read this as a table.
ARIA TO THE RESCUE?
ARIA Table Roles
• <table role="table">
• <caption role="caption">
• <thead|tbody|tfoot role="rowgroup">
• <tr role="row">
• <td role="cell">
• <th scope="col" role="columnheader">
• <th scope="row" role="rowheader">
• Cannot address re-ordered
content,
• Cannot address hidden
content.
ARIA Table Roles
• Do not use ARIA grid roles,
• Test with a screen reader,
• If your tables are generated from script, update the script.
Table with ARIA
<table id="Books" role="table">
<caption id="Cap1" role="caption">Books I May or May Not Have Read</caption>
<tr role="row">
<th role="columnheader">Author</th>
<th role="columnheader">Title</th>
<th role="columnheader">Year</th>
<th role="columnheader">ISBN-13</th>
<th role="columnheader">ISBN-10</th>
</tr>
<tr role="row">
<td role="cell">Miguel De Cervantes</td>
<td role="cell">The Ingenious Gentleman Don Quixote of La Mancha</td>
<td role="cell">1605</td>
<td role="cell">9783125798502</td>
<td role="cell">3125798507</td>
</tr>
[…]
<tr role="row">
<td role="cell">George Orwell</td>
<td role="cell">Nineteen Eighty-Four</td>
<td role="cell">1948</td>
<td role="cell">9780451524935</td>
<td role="cell">0451524934</td>
</tr>
</table>
What is display: contents
• The element does not generate any boxes,
• Its children and pseudo-elements still generate boxes,
• Text runs as normal,
• For box generation & layout, element treated as if replaced in
element tree by its contents,
• As if opening and closing tags removed,
• Also yanks it from accessibility tree.
Why It Is More Dangerous
• You cannot add it back to the accessibility tree with ARIA,
• You can give it an accessible name and properties,
• But these are not passed to screen readers,
• Some browsers do not hand the information off,
• If used as a poor-dev’s CSS reset:
• Will hide elements from assistive technology,
• Will hide semantics from assistive technology.
HOW IS THIS A THING?
Assistive Tech Is Not at Fault
• Not screen readers’ fault,
• Accessibility information comes from browser,
• Screen reader needs more than DOM to understand page,
• Cannot ignore all but the DOM:
• Years of HTML tables for layout informed screen readers,
• Screen readers developed heuristics for dealing with tables.
Detecting AT Is Not Viable
• Users generally don’t want us to be able to detect screen
readers,
• Not all screen reader users are blind anyway,
• Mouse actions are a poor proxy for sighted screen reader
users,
• Disabling a site’s CSS for screen reader users is impractical (and
a terrible, terrible idea).
CSS Is Not Blameless
• CSS already impacts HTML semantics — display: none,
• Using display: table does (generally) not impart HTML table
semantics,
• CSS flex or grid makes it easy for content order and source
order to disagree,
• CSS grid to lay out an HTML table still won’t be a table
semantically.
ARIA Is Not Ideal
• You must understand ARIA and the table structure,
• This will require you to keep current on SR and browser
support,
• You have to manage headers and other content you might
hide,
• Consider how this scales with CSS does not load,
• This is not the purpose of ARIA,
• The technique here is a stop-gap.
The Browser Is Not Right
• The CSS spec does not state that semantics should be dropped,
• As display properties, there is no reason to remove them,
• The accessibility tree should not care about visuals.
WRAP-UP
CSS Display Properties
versus
HTML Semantics

More Related Content

More from Adrian Roselli

More from Adrian Roselli (20)

Prototyping Accessibility - WordCamp Europe 2018
Prototyping Accessibility - WordCamp Europe 2018Prototyping Accessibility - WordCamp Europe 2018
Prototyping Accessibility - WordCamp Europe 2018
 
Guelph A11y Conf: Everything I Know About Accessibility I Learned from Stack ...
Guelph A11y Conf: Everything I Know About Accessibility I Learned from Stack ...Guelph A11y Conf: Everything I Know About Accessibility I Learned from Stack ...
Guelph A11y Conf: Everything I Know About Accessibility I Learned from Stack ...
 
Fringe Accessibility — Portland UX
Fringe Accessibility — Portland UXFringe Accessibility — Portland UX
Fringe Accessibility — Portland UX
 
WCBuf: CSS Display Properties versus HTML Semantics
WCBuf: CSS Display Properties versus HTML SemanticsWCBuf: CSS Display Properties versus HTML Semantics
WCBuf: CSS Display Properties versus HTML Semantics
 
Mind Your Lang — London Web Standards
Mind Your Lang — London Web StandardsMind Your Lang — London Web Standards
Mind Your Lang — London Web Standards
 
Inclusive Usability Testing - WordCamp London
Inclusive Usability Testing - WordCamp LondonInclusive Usability Testing - WordCamp London
Inclusive Usability Testing - WordCamp London
 
CSUN 2018: Everything I Know About Accessibility I Learned from Stack Overflow
CSUN 2018: Everything I Know About Accessibility I Learned from Stack OverflowCSUN 2018: Everything I Know About Accessibility I Learned from Stack Overflow
CSUN 2018: Everything I Know About Accessibility I Learned from Stack Overflow
 
Inclusive Usability Testing — a11yTOCamp
Inclusive Usability Testing — a11yTOCampInclusive Usability Testing — a11yTOCamp
Inclusive Usability Testing — a11yTOCamp
 
Selfish Accessibility - Girl Develop It Buffalo
Selfish Accessibility - Girl Develop It BuffaloSelfish Accessibility - Girl Develop It Buffalo
Selfish Accessibility - Girl Develop It Buffalo
 
Everything I Know About Accessibility I Learned from Stack Overflow
Everything I Know About Accessibility I Learned from Stack OverflowEverything I Know About Accessibility I Learned from Stack Overflow
Everything I Know About Accessibility I Learned from Stack Overflow
 
Selfish Accessibility — WordCamp Europe 2017
Selfish Accessibility — WordCamp Europe 2017Selfish Accessibility — WordCamp Europe 2017
Selfish Accessibility — WordCamp Europe 2017
 
Inclusive User Testing — Guelph Accessibility Conference
Inclusive User Testing — Guelph Accessibility ConferenceInclusive User Testing — Guelph Accessibility Conference
Inclusive User Testing — Guelph Accessibility Conference
 
Selfish Accessibility: MinneWebCon 2017
Selfish Accessibility: MinneWebCon 2017Selfish Accessibility: MinneWebCon 2017
Selfish Accessibility: MinneWebCon 2017
 
Fringe Accessibility: London Web Standards
Fringe Accessibility: London Web StandardsFringe Accessibility: London Web Standards
Fringe Accessibility: London Web Standards
 
Selfish Accessibility: Government Digital Service
Selfish Accessibility: Government Digital ServiceSelfish Accessibility: Government Digital Service
Selfish Accessibility: Government Digital Service
 
Selfish Accessibility: WordCamp London 2017
Selfish Accessibility: WordCamp London 2017Selfish Accessibility: WordCamp London 2017
Selfish Accessibility: WordCamp London 2017
 
Mind your lang (for role=drinks at CSUN 2017)
Mind your lang (for role=drinks at CSUN 2017)Mind your lang (for role=drinks at CSUN 2017)
Mind your lang (for role=drinks at CSUN 2017)
 
Implementing Accessibility: Accessibility Toronto
Implementing Accessibility: Accessibility TorontoImplementing Accessibility: Accessibility Toronto
Implementing Accessibility: Accessibility Toronto
 
Mind Your lang — Accessibility Camp Toronto 2016
Mind Your lang — Accessibility Camp Toronto 2016Mind Your lang — Accessibility Camp Toronto 2016
Mind Your lang — Accessibility Camp Toronto 2016
 
Role = Drinks 2016: Selfish Accessibility
Role = Drinks 2016: Selfish AccessibilityRole = Drinks 2016: Selfish Accessibility
Role = Drinks 2016: Selfish Accessibility
 

Recently uploaded

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
pxcywzqs
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Monica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 

Recently uploaded (20)

Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime BalliaBallia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 

a11yTO CONF 2020: CSS Display Properties v. HTML Semantics

  • 2. • I’ve written some stuff, • Member of W3C, • Building for the web since 1993, • Learn more at AdrianRoselli.com, • Avoid on Twitter @aardrian. About Adrian Roselli
  • 3. CSS Display Properties • The following can override native semantics in the browser: • display: block • display: inline • display: grid • display: flex • display: contents
  • 4. CSS Display Properties • Nothing in the HTML / CSS specifications mandates this, • Does not work in reverse: • display: table • display: table-cell
  • 5. Assistive Technology (AT) • Browsers do not convey correct semantics to AT, • Users who rely on these semantics can be stranded: • Understanding content, • Navigating a page.
  • 6. Tables as a Canary • Breaking semantics of any single required child element can break entire table: • A missing row, column or row header; • The parent table even with good rows and cells.
  • 7.
  • 8. Accessibility Tree • A sub/super-set of the DOM, • Includes UI objects of browser & objects of the document, • Created in tree for every DOM element that: • Fires an accessibility event, • Has a property, relationship or feature which needs to be exposed. • Is abstracted for dev tools.
  • 13. Chrome 86 / Windows 10 CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button> display: flex ✔ ✔ ✔ ✔ display: grid ✔ ✔ ✔ ✔ display: block ✔ ✔ ✔ ✔ display: inline-block ✔ ✔ ✔ ✔ display: contents ✔ ❌ ✔ ✔
  • 14. Firefox 82 / Windows 10 CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button> display: flex ❌1 ✔ ✔ ✔ display: grid ❌1 ✔ ✔ ✔ display: block ✔ ✔ ✔ ✔ display: inline-block ✔ ✔2 ✔ ✔ display: contents ✔ ✔2 ✔ ✔3
  • 15. Safari / macOS 10.15.6 CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button> display: flex ❌1 ✔4 ✔ ✔ display: grid ❌1 ✔4 ✔ ✔ display: block ❌2 ❌ ✔ ✔ display: inline-block ❌2 ❌ ✔ ✔ display: contents ❌3 ❌ ❌ ❌
  • 16. Chrome 86 / Android 11 CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button> display: flex ✔ ✔ ✔ ✔ display: grid ✔ ✔ ✔ ✔ display: block ✔ ✔ ✔ ✔ display: inline-block ✔ ✔ ✔ ✔ display: contents ✔ ❌1 ✔ ✔
  • 17. Safari / iOS 14 CSS <table>, etc. <ul>, <ol>, <dl> <h#> <button> display: flex ❌ ✔ ✔ ✔ display: grid ❌ ✔ ✔ ✔ display: block ❌1 ❌2 ✔ ✔ display: inline-block ❌1 ❌2 ✔ ✔ display: contents ❌1 ❌2 ❌ ❌3
  • 18. display: table • display: table, table-caption, table-row, table-cell; • Each of these will add layout-table semantics in Chrome v80+, • There is no CSS display property for col/row headers, • Requires a well-structured DOM, • Not a workaround, fix, or way to do <div>s-as-tables.
  • 19.
  • 20. display: table • As LayoutTable, LayoutRowTable, LayoutCellTable; • JAWS, Narrator will read this as a table, – But without col/row headers, • NVDA, VO, TalkBack will not read this as a table.
  • 21. ARIA TO THE RESCUE?
  • 22. ARIA Table Roles • <table role="table"> • <caption role="caption"> • <thead|tbody|tfoot role="rowgroup"> • <tr role="row"> • <td role="cell"> • <th scope="col" role="columnheader"> • <th scope="row" role="rowheader"> • Cannot address re-ordered content, • Cannot address hidden content.
  • 23. ARIA Table Roles • Do not use ARIA grid roles, • Test with a screen reader, • If your tables are generated from script, update the script.
  • 24. Table with ARIA <table id="Books" role="table"> <caption id="Cap1" role="caption">Books I May or May Not Have Read</caption> <tr role="row"> <th role="columnheader">Author</th> <th role="columnheader">Title</th> <th role="columnheader">Year</th> <th role="columnheader">ISBN-13</th> <th role="columnheader">ISBN-10</th> </tr> <tr role="row"> <td role="cell">Miguel De Cervantes</td> <td role="cell">The Ingenious Gentleman Don Quixote of La Mancha</td> <td role="cell">1605</td> <td role="cell">9783125798502</td> <td role="cell">3125798507</td> </tr> […] <tr role="row"> <td role="cell">George Orwell</td> <td role="cell">Nineteen Eighty-Four</td> <td role="cell">1948</td> <td role="cell">9780451524935</td> <td role="cell">0451524934</td> </tr> </table>
  • 25. What is display: contents • The element does not generate any boxes, • Its children and pseudo-elements still generate boxes, • Text runs as normal, • For box generation & layout, element treated as if replaced in element tree by its contents, • As if opening and closing tags removed, • Also yanks it from accessibility tree.
  • 26. Why It Is More Dangerous • You cannot add it back to the accessibility tree with ARIA, • You can give it an accessible name and properties, • But these are not passed to screen readers, • Some browsers do not hand the information off, • If used as a poor-dev’s CSS reset: • Will hide elements from assistive technology, • Will hide semantics from assistive technology.
  • 27. HOW IS THIS A THING?
  • 28. Assistive Tech Is Not at Fault • Not screen readers’ fault, • Accessibility information comes from browser, • Screen reader needs more than DOM to understand page, • Cannot ignore all but the DOM: • Years of HTML tables for layout informed screen readers, • Screen readers developed heuristics for dealing with tables.
  • 29. Detecting AT Is Not Viable • Users generally don’t want us to be able to detect screen readers, • Not all screen reader users are blind anyway, • Mouse actions are a poor proxy for sighted screen reader users, • Disabling a site’s CSS for screen reader users is impractical (and a terrible, terrible idea).
  • 30. CSS Is Not Blameless • CSS already impacts HTML semantics — display: none, • Using display: table does (generally) not impart HTML table semantics, • CSS flex or grid makes it easy for content order and source order to disagree, • CSS grid to lay out an HTML table still won’t be a table semantically.
  • 31. ARIA Is Not Ideal • You must understand ARIA and the table structure, • This will require you to keep current on SR and browser support, • You have to manage headers and other content you might hide, • Consider how this scales with CSS does not load, • This is not the purpose of ARIA, • The technique here is a stop-gap.
  • 32. The Browser Is Not Right • The CSS spec does not state that semantics should be dropped, • As display properties, there is no reason to remove them, • The accessibility tree should not care about visuals.
  • 34.

Editor's Notes

  1. CSS as implemented in browsers today can remove semantics, Conversely, you can not add it back with CSS
  2. CSS as implemented in browsers today can remove semantics, Conversely, you can not add it back with CSS
  3. If any one part of a valid table goes away, the entire thing falls down. Mis-count of rows or columns, Headers associated with wrong data. Harder to see this in action with elements that do not have so many required children in a required structure. A broken table means your code may have this elsewhere.
  4. Github just wanted to prevent wide tables from breaking its layout. It made the table scrollable instead of a container. To do that required .markdown-body table {display: block;}. That made the table useless to SR and keyboard users.
  5. Table before CSS display properties on the left Table after CSS display properties on the right Note how the entire accessibility tree is gone
  6. Caption before CSS display properties on the left Caption after CSS display properties on the right Its caption role is maintained But it is not associated with a table
  7. Th before CSS display properties on the left Th after CSS display properties on the right Not associated with the table No computed properties
  8. Td before CSS display properties on the left Td after CSS display properties on the right Not associated with the table No computed properties
  9. Chrome 80 does well with flex, grid, block, inline-block, and contents. Across tables, lists, headings, and buttons. Except lists with display: contents.
  10. <th>s with flex and grid are announced as cells, not col or row header, Inserts text leaf between each one, Issues a keyboard use warning (interactive elements must be focusable).
  11. Recognizes <table> and <caption> only; not <tr>, <th>, <td> Can navigate in VO with table commands, but column/row headers not conveyed Can navigate by row in VO, but just as a string of text. VO breaks up any text that wraps
  12. Chrome 80 does well with flex, grid, block, inline-block, and contents. Across tables, lists, headings, and buttons. Except lists with display: contents. Essentially performs as desktop Does not announce list count, position, start, end even unstyled, but does announce list on exit for Contents.
  13. Treats all cells belonging in column 1. Recognizes <dl> overall -- must have come with them finally fixing <dl>s. Still fires on double-tap with VO.
  14. If you create a structure like a table and add table-related display styles, Chrome calls it a layout table.
  15. There is a long aversion to tables owing to their mis-use for layout. So some people try to use other HTML elements, They opt to “throw ARIA” at them.
  16. You can use ARIA to re-insert lost semantics Caption role coming in ARIA 1.2
  17. Grid slides coming up
  18. I am seeing this quickly become the new hotness. I want to call this one out specifically.
  19. You may ask yourself: where is my beautiful table? You may ask yourself: where are the table semantics? And you may ask yourself: why is this so broken?
  20. Because developers used layout tables for years, SRs had to improvise to make them useable. Still using tables as my proxy, focus on SRs (which are not the only AT).
  21. How do you account for those with mobility impairments who do not use a mouse? Or mobile screen reader users who rely on touch gestures
  22. Think about how it used for vertical centering because vertical centering was not a thing in CSS for so long
  23. First Rule of ARIA! As ARIA fixes it in browser exposure, should help other AT.
  24. If CSS is your bag, or figuring out if or why your CSS is breaking everything, you may want to stick around for Manuel Matuzovic’s talk on CSS and accessibility, or Sarah Higley’s talk on how to track down root causes of issues.