Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ListItemView): div -> li default list item html tag #1698

Merged
merged 2 commits into from
Jul 15, 2024
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
Expand Up @@ -28,6 +28,7 @@ const DraggableListItem = ({
{...provided?.draggableProps}
ref={provided?.innerRef}
{...props}
role="option"
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const ListWithDnd = ({size, itemsCount, 'aria-label': ariaLabel}: ListWit
dragging={snapshot.isDragging}
ref={provided.innerRef}
endSlot={<Icon data={Grip} size={16} />}
role="option"
Copy link
Contributor

Choose a reason for hiding this comment

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

Roles different from recommended practices, see link in issue

/>
)}
</Draggable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import './ListItemView.scss';

const b = block('list-item-view');

export interface ListItemViewProps<T extends React.ElementType = 'div'>
export interface ListItemViewProps<T extends React.ElementType = 'li'>
extends QAProps,
ListItemCommonProps {
/**
Expand Down Expand Up @@ -93,7 +93,7 @@ const renderSafeIndentation = (indentation?: number) => {
};

export const ListItemView = React.forwardRef(function ListItemView<
T extends React.ElementType = 'div',
T extends React.ElementType = 'li',
>(
{
id,
Expand All @@ -120,7 +120,7 @@ export const ListItemView = React.forwardRef(function ListItemView<
}: ListItemViewPropsWithTypedAttrs<T>,
ref?: ListItemViewRef<T>,
) {
const as: React.ElementType = asProps || 'div';
const as: React.ElementType = asProps || 'li';
const isGroup = typeof expanded === 'boolean';
const onClick = disabled ? undefined : _onClick;
const activeOnHover =
Expand Down Expand Up @@ -201,7 +201,7 @@ export const ListItemView = React.forwardRef(function ListItemView<
{endSlot}
</Flex>
);
}) as <C extends React.ElementType = 'div'>({
}) as <C extends React.ElementType = 'li'>({
ref,
...props
}: ListItemViewPropsWithTypedAttrs<C> & {ref?: ListItemViewRef<C>}) => React.ReactElement;
Loading