Skip to content

Commit b77307b

Browse files
authored
fix(react-aria): removes forcing children on useARIAButton (#18879)
* Removes forcing children on useARIAButton * Change files * Fix tests
1 parent 8176afa commit b77307b

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Forces children prop with Fragment in useAccordionHeader",
4+
"packageName": "@fluentui/react-accordion",
5+
"email": "bsunderhus@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Removes forcing children on useARIAButton",
4+
"packageName": "@fluentui/react-aria",
5+
"email": "bsunderhus@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-accordion/src/components/AccordionHeader/useAccordionHeader.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const useAccordionHeader = (props: AccordionHeaderProps, ref: React.Ref<H
4444
id,
4545
disabled,
4646
'aria-controls': panel?.id,
47+
children: React.Fragment,
4748
});
4849

4950
return {

packages/react-aria/src/hooks/useARIAButton.test.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ describe('useARIAButton', () => {
2424
expect(shorthand.as).toBe('a');
2525
expect(shorthand.disabled).toBeUndefined();
2626
expect(shorthand['aria-disabled']).toBe(false);
27-
expect(shorthand.children).toBe(null);
28-
expect(shorthand.children).toBe(null);
2927
expect(shorthand.role).toBe('button');
3028
expect(shorthand.onClick).toBeInstanceOf(Function);
3129
expect(shorthand.tabIndex).toBeUndefined();
@@ -39,7 +37,6 @@ describe('useARIAButton', () => {
3937
expect(shorthand.role).toBe('button');
4038
expect(shorthand.disabled).toBeUndefined();
4139
expect(shorthand['aria-disabled']).toBe(false);
42-
expect(shorthand.children).toBe(null);
4340
expect(shorthand.tabIndex).toBe(0);
4441
expect(shorthand.onClick).toBeInstanceOf(Function);
4542
expect(shorthand.onKeyDown).toBeInstanceOf(Function);

packages/react-aria/src/hooks/useARIAButton.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ export function useARIAButton<T extends React.ButtonHTMLAttributes<HTMLElement>>
7777
}
7878
});
7979

80-
if (!shorthand.hasOwnProperty('children')) {
81-
shorthand.children = null;
82-
}
83-
8480
if (!shorthand.hasOwnProperty('as') || shorthand.as === 'button') {
8581
shorthand.as = 'button';
8682
return shorthand; // there's nothing to be done if as prop === 'button'

0 commit comments

Comments
 (0)