-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Blocks: update warning style #7866
Conversation
cf78aa7
to
16318f7
Compare
Can I ask from a design perspective what happens with translations causing this to be on 2 lines? It seems it would throw everything off quite a lot. Also what happens on smaller screens? |
It's a bit hidden in the text above, but this screenshot shows what happens when the width decreases: The same will happen if the text or buttons are bigger: Once it wraps it behaves the same as the existing style, but left aligned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving based on design. I do wonder if the fact the buttons move is great for consistency but we can explore other solutions once in. Having a giant modal isn't great either so this at least solves that one.
@aduth you asked some questions in #7886 regarding the changes here. Does this PR answer them? Specifically:
Joen adjusted the z-index for all block warnings. As far as I'm aware (and admittedly I know very little of Gutenberg at this stage), there's only an invalid block and crashed block warning. If that's the case then it shouldn't have any other effect, although I'm basing that on Joen's knowledge.
As mentioned in f04f95a it was moved to bring the crash warning to the same level in the DOM as the invalid block warning, allowing the style changes to apply to them both. Previously it was a level higher. |
The overall style is adjusted so it’s left aligned, and the buttons and ellipsis are right aligned (flowing to the line below if not enough space)
The overall style is adjusted so it’s left aligned, and the buttons and ellipsis are right aligned (flowing to the line below if not enough space)
This matches the same level as the BlockInvalid component, and ensures they can both be styled the same
Component and file name match other special blocks
Change the ‘edit as HTML’ button text for an invalid block so it better matches the action.
16318f7
to
d531fb9
Compare
The original worry was that we tend to think of only these ones as the only instances, but it was rewritten at one point to intentionally be generic, so we should be conscious of unintended impacts (including for future usage). Since it's increasing a
This seems okay. Which styles specifically, though? |
I think Joen will need to answer that, although he is away so it will be a while. If this is something that you'd rather wait for then that's fine. If it makes sense to merge now and adjust later with Joen's info then 👍
|
I would +1 to merging it now and iterating. |
If there are follow-up items, we should create an (ideally self-assigned) issue. Otherwise, not a blocker for me. |
@@ -1,27 +1,53 @@ | |||
.editor-warning { | |||
.editor-block-list__block .editor-warning { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned at #7886 (comment) that this component is used for more than just the warning for the single block in a list. It's also used for the top-level error handler, which this change broke. See #8677.
Description
Update the block warning style, moving the action buttons inline with the text, and adding a grey scrim. This prepares the warning component for the addition of a dropdown options menu. Discussion and reasons behind these changes can be found in #7604
The block warning is shown in two situations:
<BlockCrashWarning />
component is shown<BlockInvalidWarning />
is shownIn addition to style changes some text has been changed:
Edit as HTML
button is nowKeep as HTML
to better reflect the actionThis block appears to have been modified externally.
is nowThis block has been modified externally.
to remove general vaguenessThese items of text are likely to change in the future as the validation experience is improved, but for now should help with confusion.
Also to note that
InvalidBlockWarning
has been renamed toBlockInvalidWarning
so it matches the other block components.How has this been tested?
Existing unit tests cover the changes to the HTML.
To manually test the block validation message:
</p>
to trigger the block validation messageto:
To test the block crash warning message:
wp.blocks.registerBlockType( 'myplugin/mr-crashy', { title: 'Mr. Crashy', category: 'common', icon: 'warning', edit() { throw new Error(); }, save() { return ''; } } );
Mr Crashy
block to a postTo:
Types of changes
This is a non-breaking change. The block warning functionality doesn't change.
Checklist: