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

undo management: separate blocky and browser #1915

Open
jlaurens opened this issue Jun 12, 2018 · 2 comments · Fixed by #7946
Open

undo management: separate blocky and browser #1915

jlaurens opened this issue Jun 12, 2018 · 2 comments · Fixed by #7946
Labels
component: browser component: events help wanted External contributions actively solicited issue: bug Describes why the code or behaviour is wrong size: small Bugs that can be picked up and completed in 1-3 days

Comments

@jlaurens
Copy link

jlaurens commented Jun 12, 2018

There is a concurrency between Blockly undo management and browser undo management.

This affects safari and google chrome but does not affect firefox at least on OS X.

Take the fixed blockly demo at blockly/demos/fixed/index.html and add a textarea. If you perform changes in both the text area and the workspace, undo/redo with key shortcut merges Blockly undo management and browser undo management.

Here are the steps:

  1. load the modified page
  2. enter some text in the text area
  3. drag some block in the workspace
  4. trigger an undo event with the key shortcut

Problem: both the text area and the workspace are reverted during the same operation.
Expected behaviour: when the workspace has the focus, the undo/redo actions should apply to the workspace only.

Ideally, when the workspace has the focus, the menu item undo/redo action of the browser should apply to the workspace only.

Newer repro steps (2023/11/21)

  1. Run npm run start to open the playground.
  2. Type some text into the text field on the left.
  3. Drag a block into the workspace.
  4. Trigger an undo with a keyboard shortcut.
  5. Observe how the block is deleted and the text change is reverted. Expect the text to not be modified.

To Fix

Edit the keyboard shortcuts for undo and redo to call preventDefault on the event they are passed. You will need to add an extra event parameter to the callback method. Check out the type definition for keyboard shortcuts.

@samelhusseini
Copy link
Contributor

Agreed, we should only handle keyboard events for Blockly when the user is focused on a Blockly component.

@samelhusseini samelhusseini added this to the Bug Bash Backlog milestone Jun 8, 2020
@gonfunko
Copy link
Contributor

Related (?), Command Z in Safari will also reopen a closed tab, which happens in parallel with undoing the action in Blockly.

@BeksOmega BeksOmega self-assigned this Mar 18, 2024
@BeksOmega BeksOmega added help wanted External contributions actively solicited size: small Bugs that can be picked up and completed in 1-3 days and removed good first issue labels Aug 13, 2024
@BeksOmega BeksOmega removed their assignment Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: browser component: events help wanted External contributions actively solicited issue: bug Describes why the code or behaviour is wrong size: small Bugs that can be picked up and completed in 1-3 days
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants