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

Verse: Unable to exit via enter #52773

Closed
annezazu opened this issue Jul 19, 2023 · 13 comments · Fixed by #52783 or #53332
Closed

Verse: Unable to exit via enter #52773

annezazu opened this issue Jul 19, 2023 · 13 comments · Fixed by #52783 or #53332
Assignees
Labels
[Block] Verse Affects the Verse block [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended

Comments

@annezazu
Copy link
Contributor

annezazu commented Jul 19, 2023

Initially noted here #50129 (comment). When trying to exit the Verse block, the only way is to use the option to insert after/before or to use the Inserter to insert a new block. This is replicated using 6.3 RC1:

verse.mov

To address this, solutions have been offered #52783 (comment) and #52783 (comment). TLDR: a single return keeps you in the selected block, and a subsequent return exits it. This matches behavior with the List block.

@annezazu annezazu added [Type] Bug An existing feature does not function as intended [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Block] Verse Affects the Verse block labels Jul 19, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jul 20, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Jul 24, 2023
@Mamaduka
Copy link
Member

FYI, it was decided to revert the changes and mark this as wontfix. See #52783 and #52928.

@Mamaduka Mamaduka closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2023
@hanneslsm
Copy link

Linking the comments #52783 (comment) and #52783 (comment)

The verse block should have the same exit behavior as the list block.

@Mamaduka Mamaduka reopened this Jul 25, 2023
@Mamaduka
Copy link
Member

Re-opening the issue.

@annezazu, do you mind updating the description to reflect the suggested solution(s)?

@annezazu
Copy link
Contributor Author

Done.

@ellatrix
Copy link
Member

ellatrix commented Aug 3, 2023

I've been looking into this issue and tried adding a new RichText prop onSplitBr, which would split when pressing ENTER on a line break. However, I'm not convinced that we should do this. It's super confusing when you have an empty line in a verse, press Enter, and it suddenly splits in two. And what if you want more than one line between text? Imo, this block works as intended.

Verse is pretty close to how the Preformatted and Code blocks work. Enter creates a soft line break and you can add as many as you like. I also wouldn't expect two Enter pressed to exit a Code block. If exiting is difficult, it means there's a larger problem for all blocks.

@annezazu
Copy link
Contributor Author

annezazu commented Aug 3, 2023

@WordPress/gutenberg-design keen to get designer thoughts here. In my mind, this makes it incredibly hard to get out of blocks currently (another example #52774 ) and perhaps a wider solution needs to be considered.

@annezazu annezazu added the Needs Design Feedback Needs general design feedback. label Aug 3, 2023
@hanneslsm
Copy link

hanneslsm commented Aug 3, 2023

It's super confusing when you have an empty line in a verse, press Enter, and it suddenly splits in two

I didn't get this. Splitting into two verse blocks? I'd expect to be in paragraph block then again.

And what if you want more than one line between text?

You also cannot do this at the moment with paragraphs because empty paragraphs get ignored.

Verse is pretty close to how the Preformatted and Code blocks work. Enter creates a soft line break and you can add as many as you like. I also wouldn't expect two Enter pressed to exit a Code block.

Good point. I also just looked into it and the root of the problem are the visuals.
The verse block looks like a paragraph block but it behaves like a Code block.
I am really not a big fan of opinionated designs for blocks, but here it might make sense. Background, a border, font-color, font-size, an icon in the background…? cc @WordPress/gutenberg-design

@hanneslsm
Copy link

hanneslsm commented Aug 3, 2023

@WordPress/gutenberg-design keen to get designer thoughts here. In my mind, this makes it incredibly hard to get out of blocks currently (another example #52774 ) and perhaps a wider solution needs to be considered.

You got me by a minute :)
The column block has the same issue. But since we cannot also change the background or anything else in the column block, it wouldn't make sense for verse. My ideas from the previous post are obsolete.

There must be another way to indicate that the user is "locked" into a block and cannot exit via enter.

How about letting a border bottom appear when pressing enter?
I wish I knew javascript to do an interactive prototype to see if it works. Here is a static image, hope it conveys the idea:
image

@jasmussen
Copy link
Contributor

My instinct here is to leverage a similar behavior as the List block. That is, double enter exits it, but the full behavior of backspace restoring the last list item seems important:

List

That is, two enters does escape this verse:

verse

However, the precise flow would likely be this:

  • Verse line 1, type something, press enter
  • Verse line 2, don't type anything, press enter
  • You escape the verse but are still on line 2, now it's just a paragraph
  • Press backspace, you're back in the verse, but on line 2

Make sense?

@ellatrix
Copy link
Member

ellatrix commented Aug 4, 2023

It sounds to me like you only want Enter to create a paragraph when at a line break at the end of a verse, and not also in the middle of a verse, which is different from list, which also splits in the middle.

In that case, I think we should slightly modify onSplitAtEnd, to only split on a newline. That will change the behaviour for captions too, but that's fine, It's better to be consistent.

My only worry is that you can no longer insert two line breaks to have a blank line between texts, which is common is verses, and common in the Preformatted and Code blocks too.

So maybe we should only split when there are TWO previous line breaks. In that case we'll need a separate onSplitAtEnd. I will make a PR like that so you can test it.

@ellatrix
Copy link
Member

ellatrix commented Aug 4, 2023

In other words: it should be triple Enter that exits the block.

@jasmussen
Copy link
Contributor

Worth a try, especially if two or three can be tweaked in the PR somewhat easily?

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Aug 4, 2023
@ellatrix
Copy link
Member

ellatrix commented Aug 4, 2023

ready for testing

@annezazu annezazu removed the Needs Design Feedback Needs general design feedback. label Aug 30, 2023
@annezazu annezazu moved this to In Progress in WordPress 6.4 Editor Tasks Aug 30, 2023
@Mamaduka Mamaduka removed their assignment Aug 30, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in WordPress 6.4 Editor Tasks Sep 14, 2023
@mikachan mikachan removed the [Status] In Progress Tracking issues with work in progress label Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Verse Affects the Verse block [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants