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

Disable selection when resizing #17359

Merged
merged 5 commits into from Sep 9, 2019

Conversation

@swissspidy
Copy link
Member

commented Sep 6, 2019

Description

Fixes #17313.

Disables text and block selection when resizing items in the editor.

Not part of the ResizableBox component itself as it should also work in different contexts.

How has this been tested?

Tested by following the steps in #17313 and verifying that no accidental selection happens.

Screenshots

Demo Video: https://cloudup.com/cNrI6jKgDpl

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
@swissspidy

This comment has been minimized.

Copy link
Member Author

commented Sep 8, 2019

It seems that the issue is a bit bigger because of BLOCK_SELECTION_INITIAL_STATE and how the blockSelection reducer uses it. For example, when I remove blocks via the REMOVE_BLOCKS action, state is set to BLOCK_SELECTION_INITIAL_STATE, which means selection will be enabled again - even if I didn't intend to.

@senadir

This comment has been minimized.

Copy link
Contributor

commented Sep 8, 2019

this reintroduces bugs fixed by #17175 & #15884
can we possibly find a way to fix both of them? both here & on those PRs?

@swissspidy

This comment has been minimized.

Copy link
Member Author

commented Sep 9, 2019

@senadir Thanks for pointing to these PRs! I think that should be doable by not using BLOCK_SELECTION_INITIAL_STATE in the way it currently is (see my previous comment). Will test it out in a bit.

swissspidy added 2 commits Sep 9, 2019
@swissspidy swissspidy requested review from ellatrix and youknowriad as code owners Sep 9, 2019
@youknowriad youknowriad requested a review from senadir Sep 9, 2019
@senadir
senadir approved these changes Sep 9, 2019
Copy link
Contributor

left a comment

I've tested this PR and it works great without breaking other things, I have one comment but it shouldn't block this PR, and I don't have strong opinions about it.

@senadir senadir merged commit 96cadd0 into master Sep 9, 2019
2 checks passed
2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Passed
Details
@senadir senadir deleted the fix/resizing-toggle-selection branch Sep 9, 2019
@senadir senadir added this to the Gutenberg 6.5 milestone Sep 9, 2019
dd32 pushed a commit to dd32/gutenberg that referenced this pull request Sep 27, 2019
* Disable selection when resizing

* Do not return modified initial state

* Update reducer tests

* Properly pass on onResizeStart prop to ResizableCover
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.