Skip to content

Conversation

@yihuiliao
Copy link
Member

@yihuiliao yihuiliao commented Jan 12, 2026

chromatic: https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=1101

make sure it matches the new proposed changes: RSP Component Milestones (view)

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Go to S2 storybook -> TreeView -> mess around with the disabledBehavior control

🧢 Your Project:

@rspbot
Copy link

rspbot commented Jan 12, 2026

@yihuiliao yihuiliao marked this pull request as draft January 12, 2026 19:24
@rspbot
Copy link

rspbot commented Jan 12, 2026

@yihuiliao yihuiliao marked this pull request as ready for review January 13, 2026 18:33
reidbarber
reidbarber previously approved these changes Jan 13, 2026
Comment on lines +326 to +327
[ActionButtonGroupContext, {styles: treeActions, isDisabled}],
[ActionMenuContext, {styles: treeActionMenu, isQuiet: true, isDisabled}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think these should only be disabled if the disabledBehaviour is 'all', not just if the item is disabled

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isDisabled here comes from TreeState which determines isDisabled from a variety of different things. isDisabled will be false if disabledBehavior is selection

isDisabled(key: Key): boolean {
return this.state.disabledBehavior === 'all' && (this.state.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, that was really hidden up there, thanks.
can you write a test for this? seems easy to accidentally regress on this one

});
},
renderers: {
// todo - we don't support isDisabled on TreeViewItems?
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a comment left by Rob when TreeView was first implemented in S2...not sure if this is relevant anymore? we support isDisabled on TreeViewItems according to the docs

@rspbot
Copy link

rspbot commented Jan 14, 2026

@rspbot
Copy link

rspbot commented Jan 14, 2026

@rspbot
Copy link

rspbot commented Jan 14, 2026

## API Changes

react-aria-components

/react-aria-components:CellRenderProps

 CellRenderProps {
-  colIndex?: number | null
   id?: Key
   isFocusVisible: boolean
   isFocused: boolean
   isHovered: boolean
   isSelected: boolean
 }

@react-aria/interactions

/@react-aria/interactions:useFocusVisibleListener

 useFocusVisibleListener {
   fn: FocusVisibleHandler
   deps: ReadonlyArray<any>
   opts?: {
-    enabled?: boolean
-  isTextInput?: boolean
+    isTextInput?: boolean
 }
   returnVal: undefined
 }

@react-spectrum/s2

/@react-spectrum/s2:MenuSection

 MenuSection <T extends {}> {
   aria-label?: string
-  children?: ReactNode | (T) => ReactElement
+  children?: ReactNode
   defaultSelectedKeys?: 'all' | Iterable<Key>
   dependencies?: ReadonlyArray<any>
   disabledKeys?: Iterable<Key>
   disallowEmptySelection?: boolean
   items?: Iterable<T>
   onSelectionChange?: (Selection) => void
   selectedKeys?: 'all' | Iterable<Key>
   selectionMode?: SelectionMode
   shouldCloseOnSelect?: boolean
   value?: T
 }

/@react-spectrum/s2:MenuSectionProps

 MenuSectionProps <T extends {}> {
   aria-label?: string
-  children?: ReactNode | (T) => ReactElement
+  children?: ReactNode
   defaultSelectedKeys?: 'all' | Iterable<Key>
   dependencies?: ReadonlyArray<any>
   disabledKeys?: Iterable<Key>
   disallowEmptySelection?: boolean
   items?: Iterable<T>
   onSelectionChange?: (Selection) => void
   selectedKeys?: 'all' | Iterable<Key>
   selectionMode?: SelectionMode
   shouldCloseOnSelect?: boolean
   value?: T
 }

TreeViewItemContent
} from '../src';

AriaTreeTests({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we deleting this file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, i see it's a rename

Comment on lines +436 to +437
let menu = queryByRole('menu');
expect(menu).not.toBeInTheDocument();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is menu === null here?
not.toBeInTheDocument is a bit of a weird assertion for that, but i guess it works 🤷🏻

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah ig i could change it to expect(menu).toBeNull()?

@yihuiliao yihuiliao added this pull request to the merge queue Jan 14, 2026
Merged via the queue into main with commit 144a538 Jan 14, 2026
32 checks passed
@yihuiliao yihuiliao deleted the change-disabledBehavior-style branch January 14, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants