Skip to content

Framework: Drop the focus/setFocus props from block edit functions#4872

Merged
youknowriad merged 11 commits intomasterfrom
refactor/block-focus
Feb 7, 2018
Merged

Framework: Drop the focus/setFocus props from block edit functions#4872
youknowriad merged 11 commits intomasterfrom
refactor/block-focus

Conversation

@youknowriad
Copy link
Copy Markdown
Contributor

The idea of this PR is simple: We only have to worry about the position of the cursor when selecting a new block, everything else should be left as uncontrolled browser behavior.

Based on the above statement, this PR do:

  • remove the focus prop from the block edit function and replace it with an isSelected prop
  • no need for setFocus prop
  • remove focus information from the state
  • handle all explicit focus calls in the WritingFlow component: When a new block is selected, move the cursor to the right position
  • I kept the focus and setFocus prop for the block's edit function for backwards compatibility concerns now.

This should simplify the block author's work a lot, not need to handle any focus behavior inside blocks.

Testing instructions

This needs heavy testing, all writing flow micro interactions should be tested.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Framework Issues related to broader framework topics, especially as it relates to javascript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants