Skip to content

Commit 52f526a

Browse files
committed
Add more comments
1 parent d01021c commit 52f526a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/material-ui-lab/src/TreeItem/TreeItem.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ const TreeItem = React.forwardRef(function TreeItem(props, ref) {
189189

190190
const handleMouseDown = (event) => {
191191
if (event.shiftKey || event.ctrlKey || event.metaKey) {
192+
// Prevent text selection
192193
event.preventDefault();
193194
}
194195

@@ -363,7 +364,12 @@ const TreeItem = React.forwardRef(function TreeItem(props, ref) {
363364
if (multiSelect) {
364365
ariaSelected = selected;
365366
} else if (selected) {
366-
// single-selection trees unset aria-selected
367+
/* single-selection trees unset aria-selected on un-selected items.
368+
*
369+
* If the tree does not support multiple selection, aria-selected
370+
* is set to true for the selected node and it is not present on any other node in the tree.
371+
* Source: https://www.w3.org/TR/wai-aria-practices/#TreeView
372+
*/
367373
ariaSelected = true;
368374
}
369375

0 commit comments

Comments
 (0)