Treegrid Email Inbox Example
NOTE: This example is new in APG 1.1 release 2. Please provide feedback in issue 790.
The following example demonstrates how the treegrid 설계 패턴 can be used to make an interactive tree that enables users to both navigate the hierarchical structure of email conversations and also navigate elements that describe each email, such as subject and sender.
유사한 예는 다음과 같습니다:
- Data Grid Examples: Three example implementations of grid that include features relevant to presenting tabular information, such as content editing, sort, and column hiding.
- File Directory Treeview using computed properties
- File Directory Treeview using declared properties
- Navigation Treeview using computed properties
- Navigation Treeview using declared properties
Example Usage Options
This example demonstrates three different ways of implementing the keyboard navigation specified in the treegrid pattern. The following links change the behavior of the navigation keys :
-
Rows are focused first, but cells can be focused:
Useful when the desired experience is for the treegrid to act primarily like a tree where each row is treated like a node in a tree, but it is still possible for users to navigate across the cells in a row. -
Cells are focused first, but rows can be focused:
Useful when the desired experience is for the treegrid to act primarily like a grid where arrow keys move among cells, but it is still possible for users to focus a row and then start navigating the structure like a tree. -
Only cells can be focused:
Useful when the desired experience is that the treegrid act primarily like a grid and there is no need to focus complete rows.
Note: A row-only option is not provided. A treegrid where cells cannot be focused would be implemented as a tree view. A treeview that has columns in its visual presentation may be appropriate when all the following conditions are present:
- Columns are guaranteed to fit horizontally (no horizontal scrolling necessary).
- Columns are merely for attractive presentation; there is no need to navigate them individually.
- A screen reader user can easily understand the UI when all information in a row is announced as a single string without any separation.
Example
Subject | Summary | |
---|---|---|
Treegrids are awesome | Want to learn how to use them? | aaron@thegoogle.rocks |
re: Treegrids are awesome | I agree with you, they are the shizzle | joe@blahblahblah.blahblah |
re: Treegrids are awesome | They are great for showing a lot of data, like a grid | billy@dangerous.fish |
re: Treegrids are awesome | Cool, we've been needing an example and documentation | doris@rufflazydogs.sleep |
re: Treegrids are awesome | I hear the Fancytree library is going to align with this example! | someone@please-do-it.company |
re: Treegrids are awesome | Sometimes they are more like trees, others are more like grids | mari@beingpractical.com |
re: Treegrids are awesome | Cool, when it's a tree, let's keep left/right to collapse/expand | issie@imadeadcatsadly.wascute |
re: Treegrids are awesome | I see, sometimes right arrow moves by column | kitten@kittenseason.future |
키보드 지원
NOTE: The following table includes descriptions of how keyboard commands move focus among cells and rows in the treegrid implementation on this page. In the example on this page, some cells contain a single focusable widget, and if a cell contains a widget, the cell is not focusable; the widget receives focus instead of the cell. So, when a keyboard command description says a command moves focus to a cell, the command may either focus the cell or a widget inside the cell.
키 | 기능 |
---|---|
Right Arrow |
|
Left Arrow |
|
Down Arrow |
|
Up Arrow |
|
Tab |
|
Shift + Tab |
|
Home |
|
End |
|
Control + Home |
|
Control + End |
|
Enter |
|
Role, Property, State, Tabindex 어트리뷰트
역할(role) | 어트리뷰트 | 엘리먼트 | 사용법 |
---|---|---|---|
treegrid |
table |
Identifies the element as a treegrid . |
|
aria-label="Inbox" |
table |
Provides an accessible name for the treegrid . |
|
row |
tr |
|
|
tabindex="-1" |
tr or td |
|
|
tabindex="0" |
tr or td |
|
|
aria-expanded="false" |
tr or td |
|
|
aria-expanded="true" |
tr or td |
|
|
aria-level="number" |
tr |
|
|
aria-setsize="number" |
tr |
Defines the number of rows in the set of rows that are in the same branch and at the same level within the hierarchy. | |
aria-posinset="number" |
tr |
|
|
gridcell |
td |
|
NOTE: Due to an error in the ARIA 1.1 specification, the aria-posinset
and aria-setsize
properties are not supported on row elements.
This is being corrected in ARIA 1.2.
Consequently, when validating the HTML in this example, errors are generated.
Javascript와 CSS 소스 코드
- CSS: treegrid-1.css
- Javascript: treegrid-1.js
HTML Source Code