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

Add block mobile toolbar with move/settings/delete controls. #1872

Merged
merged 3 commits into from
Jul 14, 2017

Conversation

mtias
Copy link
Member

@mtias mtias commented Jul 12, 2017

@mtias mtias added [Feature] Blocks Overall functionality of blocks Mobile Web Viewport sizes for mobile and tablet devices labels Jul 12, 2017
@mtias
Copy link
Member Author

mtias commented Jul 12, 2017

@jasmussen going with this icon for now because we don't have an ellipsis.

@jasmussen
Copy link
Contributor

We should have. Try it, ellipsis. Our Dashicons sprite is ahead of the dev docs.

@jasmussen
Copy link
Contributor

Btw 😍

@@ -9,7 +9,7 @@ import classnames from 'classnames';
import './style.scss';
import IconButton from '../icon-button';

function Toolbar( { controls = [], children } ) {
function Toolbar( { controls = [], children, className = '' } ) {
Copy link
Member

Choose a reason for hiding this comment

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

classnames is smart enough to ignore an undefined value; the default can be removed.

@@ -65,6 +65,34 @@
transition: 0.2s outline;
}

&.is-showing-mobile-controls {
.editor-visual-editor__block-controls > div {
Copy link
Member

Choose a reason for hiding this comment

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

Relies on slot behavior wrapping with div. Might be less fragile by targeting anything except mobile tools:

.editor-visual-editor__block-controls > :not( .editor-visual-editor__mobile-tools ) {

}
}
.editor-block-settings-menu {
z-index: 99;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn't seem to be needed anymore with the latest approach.

<IconButton
className="editor-visual-editor__mobile-toggle"
onClick={ this.toggleMobileControls }
aria-label={ __( 'Toggle extra block controls' ) }
Copy link
Member

Choose a reason for hiding this comment

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

Redundant with label prop below (IconButton uses label to apply aria-label).

className="editor-visual-editor__mobile-toggle"
onClick={ this.toggleMobileControls }
aria-label={ __( 'Toggle extra block controls' ) }
aria-expanded={ true }
Copy link
Member

Choose a reason for hiding this comment

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

Minor: ={ true } can be dropped.

aria-expanded={ true }
label={ __( 'Toggle Controls' ) }
>
<Dashicon icon="ellipsis" />
Copy link
Member

Choose a reason for hiding this comment

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

IconButton renders Dashicon via its icon prop, i.e. <IconButton icon="ellipsis" />

@@ -364,6 +376,19 @@ class VisualEditorBlock extends Component {
<div className="editor-visual-editor__block-controls">
<BlockSwitcher uid={ block.uid } />
<Slot name="Formatting.Toolbar" />
<Toolbar className="editor-visual-editor__mobile-tools">
{ ( showUI || isHovered ) && <BlockMover uids={ [ block.uid ] } /> }
Copy link
Member

Choose a reason for hiding this comment

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

Curious if we need both BlockMover here and above, or if we could apply styles to the root element when 'is-showing-mobile-controls' is applied to appear as it does with the Toolbar component.

Copy link
Member Author

Choose a reason for hiding this comment

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

Tried this but could not get it to work on mobile reliably between proper flex positioning, sticky position, etc.

@mtias
Copy link
Member Author

mtias commented Jul 14, 2017

Going to merge this.

@mtias mtias merged commit b1e234f into master Jul 14, 2017
@mtias mtias deleted the add/mobile-block-controls branch July 14, 2017 11:01
Tug pushed a commit that referenced this pull request Feb 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks Mobile Web Viewport sizes for mobile and tablet devices
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants