You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ActionList.GroupHeading roll out improvements (#4395)
* ActionList.GroupHeading roll out improvements
* fix tests
* add a deprecated TS notice
* Create chilly-buckets-kick.md
* messed up the conflict
* code review comment address
* fix test and add another case
* add an underscore to the internal bc title
ActionList.Group: deprecate `title` prop - please use `ActionList.GroupHeading` instead
5
+
ActionList.GroupHeading: update the warning to be an error if there is no explict `as` prop for list `role` action lists.
6
+
ActionList.GroupHeading: There shouldn't be an `as` prop on `ActionList.GroupHeading` for `listbox` or `menu` role action lists. console.error if there is one
"Looks like you are trying to set a heading level to a menu role. Group headings for menu type action lists are for representational purposes, and rendered as divs. Therefore they don't need a heading level.",
276
+
)
277
+
expect(spy).toHaveBeenCalled()
278
+
spy.mockRestore()
279
+
})
280
+
252
281
it('should render the ActionList.GroupHeading component as a heading with the given heading level',async()=>{
// 'as' prop is required for list roles. <GroupHeading as="h2">...</GroupHeading>
144
+
!missingAsForList,
137
145
`You are setting a heading for a list, that requires a heading level. Please use 'as' prop to set a proper heading level.`,
138
146
)
139
147
148
+
invariant(
149
+
// 'as' prop on listbox or menu roles are not needed since they are rendered as divs and they could be misleading.
150
+
!unnecessaryAsForListboxOrMenu,
151
+
`Looks like you are trying to set a heading level to a ${listRole} role. Group headings for ${listRole} type action lists are for representational purposes, and rendered as divs. Therefore they don't need a heading level.`,
// for explicit (role="list" is passed as prop) and implicit list roles (ActionList ins rendered as list by default), group titles are proper heading tags.
0 commit comments