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 incorrect aria description in List View #24533

Merged
merged 2 commits into from Aug 13, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -12,7 +12,15 @@ import BlockNavigationBlockSelectButton from './block-select-button';

const BlockNavigationBlockContents = forwardRef(
(
{ onClick, block, isSelected, position, siblingCount, level, ...props },
{
onClick,
block,
isSelected,
position,
siblingBlockCount,
level,
...props
},
ref
) => {
const {
Expand All @@ -27,7 +35,7 @@ const BlockNavigationBlockContents = forwardRef(
onClick={ onClick }
isSelected={ isSelected }
position={ position }
siblingCount={ siblingCount }
siblingBlockCount={ siblingBlockCount }
level={ level }
{ ...props }
/>
Expand All @@ -39,7 +47,7 @@ const BlockNavigationBlockContents = forwardRef(
onClick={ onClick }
isSelected={ isSelected }
position={ position }
siblingCount={ siblingCount }
siblingBlockCount={ siblingBlockCount }
level={ level }
{ ...props }
/>
Expand Down
Expand Up @@ -28,7 +28,7 @@ function BlockNavigationBlockSelectButton(
isSelected,
onClick,
position,
siblingCount,
siblingBlockCount,
level,
tabIndex,
onFocus,
Expand All @@ -43,7 +43,7 @@ function BlockNavigationBlockSelectButton(
const descriptionId = `block-navigation-block-select-button__${ instanceId }`;
const blockPositionDescription = getBlockPositionDescription(
position,
siblingCount,
siblingBlockCount,
level
);

Expand Down
Expand Up @@ -48,7 +48,7 @@ function BlockNavigationBlockSlot( props, ref ) {
block,
isSelected,
position,
siblingCount,
siblingBlockCount,
level,
tabIndex,
onFocus,
Expand All @@ -59,7 +59,7 @@ function BlockNavigationBlockSlot( props, ref ) {
const descriptionId = `block-navigation-block-slot__${ instanceId }`;
const blockPositionDescription = getBlockPositionDescription(
position,
siblingCount,
siblingBlockCount,
level
);

Expand Down
Expand Up @@ -37,6 +37,7 @@ export default function BlockNavigationBlock( {
position,
level,
rowCount,
siblingBlockCount,
showBlockMovers,
terminatedLevels,
path,
Expand All @@ -49,9 +50,7 @@ export default function BlockNavigationBlock( {
);
const { clientId } = block;

// Subtract 1 from rowCount, as it includes the block appender.
const siblingCount = rowCount - 1;
const hasSiblings = siblingCount > 0;
const hasSiblings = siblingBlockCount > 0;
const hasRenderedMovers = showBlockMovers && hasSiblings;
const hasVisibleMovers = isHovered || isFocused;
const moverCellClassName = classnames(
Expand Down Expand Up @@ -102,7 +101,7 @@ export default function BlockNavigationBlock( {
onClick={ () => onClick( block.clientId ) }
isSelected={ isSelected }
position={ position }
siblingCount={ siblingCount }
siblingBlockCount={ siblingBlockCount }
level={ level }
ref={ ref }
tabIndex={ tabIndex }
Expand Down
Expand Up @@ -36,9 +36,8 @@ export default function BlockNavigationBranch( props ) {
selectedBlockClientId === parentClientId;
const hasAppender = itemHasAppender( parentBlockClientId );
// Add +1 to the rowCount to take the block appender into account.
const rowCount = hasAppender
? filteredBlocks.length + 1
: filteredBlocks.length;
const blockCount = filteredBlocks.length;
const rowCount = hasAppender ? blockCount + 1 : blockCount;
const appenderPosition = rowCount;

return (
Expand All @@ -64,6 +63,7 @@ export default function BlockNavigationBranch( props ) {
level={ level }
position={ position }
rowCount={ rowCount }
siblingBlockCount={ blockCount }
showBlockMovers={ showBlockMovers }
terminatedLevels={ terminatedLevels }
path={ updatedPath }
Expand Down