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

Try smaller up/down arrows, and focus management #4631

Merged
merged 2 commits into from
Jan 23, 2018
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
4 changes: 2 additions & 2 deletions editor/components/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function BlockMover( { onMoveUp, onMoveDown, isFirst, isLast, uids, block
<IconButton
className="editor-block-mover__control"
onClick={ isFirst ? null : onMoveUp }
icon="arrow-up-alt2"
icon={ <svg tabIndex="-1" width="18" height="18" xmlns="http://www.w3.org/2000/svg"><path d="M12.293 12.207L9 8.914l-3.293 3.293-1.414-1.414L9 6.086l4.707 4.707z" /></svg> }
tooltip={ __( 'Move Up' ) }
label={ getBlockMoverLabel(
uids.length,
Expand All @@ -49,7 +49,7 @@ export function BlockMover( { onMoveUp, onMoveDown, isFirst, isLast, uids, block
<IconButton
className="editor-block-mover__control"
onClick={ isLast ? null : onMoveDown }
icon="arrow-down-alt2"
icon={ <svg tabIndex="-1" width="18" height="18" xmlns="http://www.w3.org/2000/svg"><path d="M12.293 6.086L9 9.379 5.707 6.086 4.293 7.5 9 12.207 13.707 7.5z" /></svg> }
tooltip={ __( 'Move Down' ) }
label={ getBlockMoverLabel(
uids.length,
Expand Down
21 changes: 18 additions & 3 deletions editor/components/block-mover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,30 @@
margin-bottom: 4px;
}

&:not(:disabled):hover {
// unstyle inherited icon button styles
&:not(:disabled):hover,
&:not(:disabled):active,
&:not(:disabled):focus {
box-shadow: none;
color: inherit;
}

// apply styles to SVG directly
svg {
display: block;
position: relative; // Fixing the Safari bug for `<button>`s overflow
border-radius: 50%;
}

&:not(:disabled):hover svg {
@include button-style__hover;
}

&:not(:disabled):active {
&:not(:disabled):active svg {
@include button-style__active;
}

&:not(:disabled):focus {
&:not(:disabled):focus svg {
@include button-style__focus-active;
}
}
2 changes: 0 additions & 2 deletions editor/components/block-mover/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ describe( 'BlockMover', () => {
expect( moveUp.props() ).toMatchObject( {
className: 'editor-block-mover__control',
onClick: undefined,
icon: 'arrow-up-alt2',
label: 'Move 2 blocks from position 1 up by one place',
'aria-disabled': undefined,
} );
expect( moveDown.props() ).toMatchObject( {
className: 'editor-block-mover__control',
onClick: undefined,
icon: 'arrow-down-alt2',
label: 'Move 2 blocks from position 1 down by one place',
'aria-disabled': undefined,
} );
Expand Down