-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Restore default border and focus style on image url input field. #58505
Conversation
As I mentioned in this PR description, there's more inconsistencies to fix:
I will create a follow-up issue to keep changes in this PR to a minimum. |
Size Change: -65 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
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 have tested the change with the media & text block and image block.
The focus style is corrected and the size and alignments of the button matches the one in the link control that is used for the paragraph.
@WordPress/gutenberg-design @t-hamano in the context of the ongoing effort to standardize sizes of controls and buttons, see #46734, can you please clarify what size these buttons should use? I'm not sure this is a case that hae been taken into consideration on #46734 |
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.
As far as I know, URLInput
component has been around for a very long time, as evidenced by the fact that they are class-based components. I think the fundamental problem is that we are using the input
element itself, which requires various style customizations.
My guess is that this input
element can be replaced with a TextControl
component. If we do so, I think that way we can restore focus style to the default and at the same time remove many CSS styles (padding, margin, height, border etc).
In the future, as mentioned in #50893, it may be replaced with the LinkControl
component.
Assuming the input field must now be 40 pixels, should the buttons be 40 pixels as well?
In this PR, the button size is back to 36px, so I think we should change it to 32px or 40px.
How about changing the button size to 32px and aligning it vertically with the 40px input field?
Additionally, we will also need to adjust the balance of the layout when opening the link settings.
Sure, standardizing would be welcome. However, that would a bigger refactoring that is out of the scope of this PR. We should always try to keep changes limited to the specific issue we're trying to solve. This PR only aims to:
Anything else should go in a separate issue. I already created #58507
If we make the inpput field 40 and the buttons 32, it won't look that nice especially for the button inside the input field. I'd rather make them 40. Screenshot with focused buttons to illustrate how it would look with 32:
Good point, thank you. Edit: Ok I will use 32 for the buttons, as it's the simplest solution for now. |
Noting that the image link settings spacing, left/right padding and top border look broken on trunk as well. Screenshot from current trunk: I'll try to adjust that a little keeping changes to a minimum as that's out of the scope of this issue. Further adjustments should be handled in a separate issue, see #58507 |
e712912
to
d7374ed
Compare
@richtabor just in case you have any thoughts here after you've done so much work with link control in general. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -281,6 +281,7 @@ If passed, children are rendered after the input. | |||
label={ __( 'Submit' ) } | |||
icon={ keyboardReturn } | |||
className="block-editor-link-control__search-submit" | |||
size="compact" |
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.
Since the code example focuses on LinkControlSearchInput
, I believe this prop on the Button
component is unnecessary.
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'm not sure I agree. Your argumentation could then be made for other things in this example, for example the HStack
component would be unnecessary together with the justify
prop. The className
prop would be unnecessary. Instead, I think that code examples should be a full representation of the intended usage because developers will just copy and paste them. If the code example is incomplete or inaccurate, that would lead to inconsistencies or even bugs.
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 see. I don't have a strong opinion on this, so either is fine. However, I was just curious because there was no code example of opting in this prop to the Button
component in the Gutenberg documentation.
padding: $grid-unit-10; | ||
padding-left: $grid-unit-20; | ||
padding: $grid-unit-20; | ||
padding-right: $grid-unit-10; |
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.
To me, this padding seems a bit large. How about just applying padding: $grid-unit-10
?
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.
This is the container of the image URL input field. For clarity, the one with lightbox background in the screenshot below. For consistency with the normal link input field UI, the padding must be 16 pixels The only difference is that the image URL input has buttons outside of the input on the right so the right padding must be smaller for a better balance, and it's unchanged: it was 8 pixels also before.
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.
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.
To me, the padding looks okay and it's more consistent with the enw UI of the LinkControl which is not surprising because that padding is supposed to be 16 pixels, accordingly to teh mockups and design I've seen.
Screenshots: before, after, and compared to the LinkControl where you can see the spacing is almost identical:
I'm not sure this PR is the right place to over-optimize the layout. This PR has a different scope. Moreover, the UI will be sooner or later replaced with the LinkControl. I'm not against further improvements but if you feel there's room for (unrelated) layout adjustments I'd kindly ask you to please create a separate issue.
padding: $grid-unit-10; | ||
padding-left: $grid-unit-20; |
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.
Is there a reason why only the left padding is large? How about unifying it with $grid-unit-10
?
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.
Yes there is a reason. For consistency with the normal link URL input field, where the left padding is 16 pixels. Pn trunk, besides the inconsistent focus style, the left padding is cleaerly inconsistent. See screenshot below.
Worth reminding there's some large inconsistency with the padding of form controls throughout the editor UI and that's tracked in #57394 It would be great to give that issue some priority.
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 see, so how about making the padding on the right side $grid-unit-20
as well? The URL field of the MediaReplaceFlow component has 16px padding applied to the left and right sides.
Alternatively, to narrow the scope of this PR, it might be a good idea to revert the padding change and address it in the future with #57394.
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.
Fair enough. I will change the left padding. I'd be more glad to change it if I knew what the correct padding to use is. As I said, there's large inconsistency across the editor and that should be addressed in #57394.
Personally, I don't like the 16 pixels left padding. To better clarify: I don't like left padding when it's uneven with top and bottom padding. I think that's visually unbalanced and doesn't help readability. It feels like an unnecessary 'empty' space. Regarding the right padding, I think it should be addressed in the context of a new issue I created, see #58679
Instead of dedicating a lot of time to force this component to look and feel consistent with LinkControl, why not migrate it to actually use LinkControl, as detailed in #50893? That way we get all the benefits of LinkControl, and a consistent linking experience wherever you are in WordPress. |
@richtabor sure, that would be welcome. As I mentioned earlier, this PR is about accessibility and only aims to restore a correct focus style. It brings in some additional CSS changes for the sole purpose to not make these input fields look ugly and inconsistent. Any other change or bigger refactoring should go in a separate issue. Edit: Oh well I meant that there is an issue, but no PR yet for that refactoring. In the meantime this is a smaller, self-contained improvement that can land in the next WordPress release, while I guess that for a larger refactoring we'll have to wait a little longer. |
I reported the main pending points in a separate issue at #58840 |
My biggest concern is that the final release of Gutenberg, which will be bundled with WP6.5, is just around the corner. Once that version is released, enhancements should not be backportable. We need more time to find the ideal solution. I think we need to find a realistic landing point for WP6.5. Once again, I would like to mention the problems with the current trunk that I think should at least be fixed in this PR. Input field in the inline text URL popover has no default border (Regression with #58666): Input field in URL popover opened from block toolbar has no default border: Border layout is incorrect when opening the Link Settings @afercia @richtabor What is your best solution in WP6.5? |
I say we fix this, and..
add the border here (if not fixed by the above). If they're separate, that's fine. |
I appreciate the work @afercia has done on this PR. But how about following the title of this PR and simply restoring the default border? All we need to do is make the following changes in trunk: diff --git a/packages/block-editor/src/components/url-input/style.scss b/packages/block-editor/src/components/url-input/style.scss
index 66f71e8035..f8d84ae43b 100644
--- a/packages/block-editor/src/components/url-input/style.scss
+++ b/packages/block-editor/src/components/url-input/style.scss
@@ -18,10 +18,6 @@ $input-size: 300px;
margin-left: 0;
margin-right: 0;
- &:not(:focus) {
- border-color: transparent;
- }
-
/* Fonts smaller than 16px causes mobile safari to zoom. */
font-size: $mobile-text-min-font-size;
@include break-small { The broken border layout when opening Link Setting is a bug, so it should be possible to backport it even after the release of WP6.5 Beta1 (Of course, I also think it's a bug that the input field doesn't have a default border). We should be able to refer to the discussion in this PR when improving the layout and size in the future. |
@t-hamano I'm not sure I understand your point. The lack of consistent focus style (already fixed elsewhere) and the lack of the default border are bugs, not enhancements. This PR originally contained only the very minimum of CSS changes necessary to make the restored focus style and border not look ugly. It now contains much more than originally needed because I received feedback during code review to 'how about fixing also this' and 'how about adjusting also that'... I tried to address the received feedback but I see now that maybe I shouldn't have done that. All those unnecessary adjustments made this PR take much longer than needed. I would like to point out that I remarked a few times to please try to keep this PR focused on its original scope. It is now bigger than planned because of the feedback I received, including the feedback I received from you. Overall, I think this PR fixes a bug and improves the layout. Changes don't need to be perfect. They need to be good enough. Lastly, I'm not sure the overall process followed in this PR is ideal to make contributors work pleasant and efficient. I know everybody's intent is good, but we actually wasted a lot of time on this PR. Fair enough, I will revert all the changes except the one that restores the border. It will look ugly. For the future, I'd kindly ask everyone to be more respectful of other contributors time. |
I apologize if my reviews have been inconsistent. However, like all contributors, I have limited time to contribute. I will try to do my best in all reviews within that time. |
381f306
to
416da3c
Compare
In the latest commit I reverted all changes except the restored border. See attached screenshot below with the various states and comparison with the LinkControl UI. All the small glitches and inconsistencies are now back, including:
I would like to note that if this is what the prevalent opinion on this PR really wants, then I'm afraid we have different ideas on what is good to be merged, and what is best for a better user experience. |
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.
LGTM!
I would like to note that if this is what the prevalent opinion on this PR really wants, then I'm afraid we have different ideas on what is good to be merged, and what is best for a better user experience.
I understand this, of course. After merging this PR, we will still need to continue the discussion.
Sure thanks. For clarity, I'm not against accurate revisions. I would love to see the same level of accuracy for all the pull requests, including the ones that broke the border and focus style. |
This PR is not part of the final Gutenberg version 17.7 that will be bundled with WP6.5, so it must be backported. This PR fixes the "bug" of missing default focus, and also fixes the "regression" that occurred in #58666, so it should be backportable. |
) * Restore default focus style on image url input field. * Make buttons use the 32 pixels compat size. * Remove image link settings top border. * Decrease left padding to grid-unit-15. * Restore the default border. * Revert all changes but the restored border. Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: annezazu <annezazu@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org>
I just cherry-picked this PR to the backports/beta1 branch to get it included in the next release: f8897cc |
) * Restore default focus style on image url input field. * Make buttons use the 32 pixels compat size. * Remove image link settings top border. * Decrease left padding to grid-unit-15. * Restore the default border. * Revert all changes but the restored border. Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: annezazu <annezazu@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org>
) * Restore default focus style on image url input field. * Make buttons use the 32 pixels compat size. * Remove image link settings top border. * Decrease left padding to grid-unit-15. * Restore the default border. * Revert all changes but the restored border. Co-authored-by: afercia <afercia@git.wordpress.org> Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: annezazu <annezazu@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org>
Fixes #58494
What?
The UI to inseert link on images is different from the default URL input UI and has now an insufficient, and inconsistent, focus style. This UI is used in a few blocks e.g. Image, Media & Text, etc.
Why?
Focus style must always be clear. Ideally it should be consistent across all the input fields in the editor UI.
There's no good reason why the image URL input mut look and work differently from the default URL input UI used for text, besides very specific features that are only available for images.
This PR aims to make the image URL input use the default focus style. To do so, some additional CSS changes are necessary like adjusting the input and button sizes to the new defaults and better spacing and alignment. I tried to keep the changest o a minimum.
There's more inconsistencies to fix, both visual and functional. I'll create a follow=up issue.
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Before: non focused and focused:
After: non focused and focused:
Compare with the default URL input UI: