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

select element doesn't work in paragraph #15933

Closed
joyously opened this issue May 31, 2019 · 4 comments
Closed

select element doesn't work in paragraph #15933

joyously opened this issue May 31, 2019 · 4 comments
Labels
[Status] Not Implemented Issue/PR we will (likely) not implement. [Type] Bug An existing feature does not function as intended

Comments

@joyously
Copy link

A <select> element in a paragraph block looks correct, but does not show the <option> values.
I checked the pointer-events CSS property and it was set to auto.
I tested this on GB 5.8.0, using Twenty Nineteen.

To reproduce
Steps to reproduce the behavior:

  1. Add a Custom HTML block.
  2. Enter HTML with a <select> and <option>s elements.
  3. Click on Preview on the HTML block.
  4. See that the select drops down to show the options.
  5. Add a Paragraph block.
  6. Edit the block's HTML.
  7. Enter the same HTML as in the Custom HTML block.
  8. Edit the block visually.
  9. See that the select does not drop down to show the options.

Expected behavior
The select in both blocks should show the option values the same way.

Screenshots
Peek 2019-05-30 23-01

Desktop

  • OS: Ubuntu Studio 16.04
  • Browser Firefox
  • Version 66
@talldan
Copy link
Contributor

talldan commented May 31, 2019

Hi @joyously. What's the use-case for putting a select within a paragraph block? Curiously this works in Chrome, but not in Firefox. And I thought browser inconsistencies were a thing of the past!

Anyway, most blocks aren't intended to support arbitrary markup, with many it'll cause a block validation error. For example if you try putting two <p> tags inside a paragraph block, it'll show a validation error because there's no way for the editor to know how to parse the altered markup back into a block.

The Custom HTML block was created for this purpose, and as mentioned the markup works fine there.

As such, I'm going to close the issue and mark as Won't Fix, but by all means the conversation can continue, and if it turns out there is something to fix the issue can be reopened.

@talldan talldan closed this as completed May 31, 2019
@talldan talldan added [Status] Not Implemented Issue/PR we will (likely) not implement. [Type] Bug An existing feature does not function as intended labels May 31, 2019
@joyously
Copy link
Author

My use case was to test my theme styles. I didn't see any other way to enter a select.
As you can see here the Custom HTML block uses an iframe, so I can't style anything in there.

Regardless of whether a select should be in a paragraph, it should still work when it is. There are no validation errors. The browser can handle that markup (as shown in the Custom HTML block), so why doesn't it work?

@joyously
Copy link
Author

I was just thinking that if I was writing a blog on HTML tutorials, I would want to be able to use the elements in my prose to show live examples. Why would any inline element be a problem for any block element?
And last I checked, WP was supporting the 2 latest versions of Firefox and Chrome.
https://make.wordpress.org/core/handbook/best-practices/browser-support/
https://make.wordpress.org/core/2017/02/28/the-new-editor-and-browser-support/

@talldan
Copy link
Contributor

talldan commented Jun 4, 2019

I was just thinking that if I was writing a blog on HTML tutorials, I would want to be able to use the elements in my prose to show live examples. Why would any inline element be a problem for any block element?

Yep, that's an interesting use case that doesn't seem well supported at the moment. The Custom HTML block does seem to be the best option, so it's a shame that it doesn't support styles properly.

#9129 seems to be the issue covering it.

Why would any inline element be a problem for any block element?

The issue is that blocks perform validation on their markup to check if the block's HTML is as expected:
https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#validation

Editing the HTML can cause this validation to fail. In the worst case the block's attributes won't be properly parsable if the content has changed radically.

I found a few issues that are related:

I suppose the core of the issue is that you want to be able to insert inline custom HTML while maintaining a good writing experience. In a block that's properly intended to support that experience, the select would ideally work consistently across browsers. Perhaps also a secondary issue that the validation issues that can arise from the 'Edit as HTML' option aren't abundantly clear to users.

And last I checked, WP was supporting the 2 latest versions of Firefox and Chrome.

I just checked my comment above and I can't see where I said that this wasn't the case 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Not Implemented Issue/PR we will (likely) not implement. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants