Skip to content

Commit

Permalink
Update: Show parent block as selected when there is content locking
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Sep 6, 2022
1 parent 2c8ae8e commit 7ea9afb
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/block-editor/src/components/list-view/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function ListViewBlock( {
}

const classes = classnames( {
'is-selected': isSelected,
'is-selected': isSelected || ( isExpanded && isContentLocked ),
'is-first-selected': isFirstSelectedBlock,
'is-last-selected': isLastSelectedBlock,
'is-branch-selected': isBranchSelected,
Expand Down Expand Up @@ -211,14 +211,18 @@ function ListViewBlock( {
id={ `list-view-block-${ clientId }` }
data-block={ clientId }
isExpanded={ isContentLocked ? undefined : isExpanded }
aria-selected={ !! isSelected }
aria-selected={
!! ( isSelected || ( isExpanded && isContentLocked ) )
}
>
<TreeGridCell
className="block-editor-list-view-block__contents-cell"
colSpan={ colSpan }
ref={ cellRef }
aria-label={ blockAriaLabel }
aria-selected={ !! isSelected }
aria-selected={
!! ( isSelected || ( isExpanded && isContentLocked ) )
}
aria-expanded={ isContentLocked ? undefined : isExpanded }
aria-describedby={ descriptionId }
>
Expand All @@ -228,7 +232,9 @@ function ListViewBlock( {
block={ block }
onClick={ selectEditorBlock }
onToggleExpanded={ toggleExpanded }
isSelected={ isSelected }
isSelected={
isSelected || ( isExpanded && isContentLocked )
}
position={ position }
siblingBlockCount={ siblingBlockCount }
level={ level }
Expand Down Expand Up @@ -283,7 +289,9 @@ function ListViewBlock( {
{ showBlockActions && (
<TreeGridCell
className={ listViewBlockSettingsClassName }
aria-selected={ !! isSelected }
aria-selected={
!! ( isSelected || ( isExpanded && isContentLocked ) )
}
>
{ ( { ref, tabIndex, onFocus } ) => (
<BlockSettingsDropdown
Expand Down

0 comments on commit 7ea9afb

Please sign in to comment.