Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "revert: MenuItem root slot only supports div",
"packageName": "@fluentui/react-menu",
"email": "lingfangao@hotmail.com",
"dependentChangeType": "patch"
}
6 changes: 2 additions & 4 deletions packages/react-components/react-menu/etc/react-menu.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export type MenuItemSelectableState = MenuItemSelectableProps & {

// @public (undocumented)
export type MenuItemSlots = {
root: Slot<'div', 'button'>;
root: Slot<'div'>;
icon?: Slot<'span'>;
checkmark?: Slot<'span'>;
submenuIndicator?: Slot<'span'>;
Expand All @@ -171,9 +171,7 @@ export type MenuItemSlots = {
};

// @public (undocumented)
export type MenuItemState = ComponentState<MenuItemSlots> & Required<Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>> & {
isNativeButton: boolean;
};
export type MenuItemState = ComponentState<MenuItemSlots> & Required<Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>>;

// @public
export const MenuList: ForwardRefComponent<MenuListProps>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';

export type MenuItemSlots = {
root: Slot<'div', 'button'>;
root: Slot<'div'>;

/**
* Icon slot rendered before children content
Expand Down Expand Up @@ -55,6 +55,4 @@ export type MenuItemProps = ComponentProps<Partial<MenuItemSlots>> & {
};

export type MenuItemState = ComponentState<MenuItemSlots> &
Required<Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>> & {
isNativeButton: boolean;
};
Required<Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>>;
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const useMenuItem_unstable = (props: MenuItemProps, ref: React.Ref<ARIABu
content: 'span',
secondaryContent: 'span',
},
isNativeButton: as === 'button',
root: getNativeElementProps(
as,
useARIAButtonProps(as, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,6 @@ export const menuItemClassNames: SlotClassNames<MenuItemSlots> = {
const useStyles = makeStyles({
focusIndicator: createFocusOutlineStyle(),
// TODO: this should be extracted to another package
resetButton: {
boxSizing: 'content-box',
backgroundColor: 'inherit',
color: 'inherit',
fontFamily: 'inherit',
fontSize: 'inherit',
lineHeight: 'normal',
...shorthands.borderColor('transparent'),
...shorthands.overflow('visible'),
...shorthands.padding(0),
WebkitAppearance: 'button',
textAlign: 'unset',
},
root: {
...shorthands.borderRadius(tokens.borderRadiusMedium),
position: 'relative',
Expand Down Expand Up @@ -115,7 +102,6 @@ export const useMenuItemStyles_unstable = (state: MenuItemState) => {
const styles = useStyles();
state.root.className = mergeClasses(
menuItemClassNames.root,
state.isNativeButton && styles.resetButton,
styles.root,
styles.focusIndicator,
state.disabled && styles.disabled,
Expand Down