Skip to content

FormTokenField: Fix token overflow when moving cursor left or right#52662

Merged
t-hamano merged 3 commits intotrunkfrom
form-token-field/padding-overflow
Jul 18, 2023
Merged

FormTokenField: Fix token overflow when moving cursor left or right#52662
t-hamano merged 3 commits intotrunkfrom
form-token-field/padding-overflow

Conversation

@t-hamano
Copy link
Contributor

@t-hamano t-hamano commented Jul 16, 2023

What?

This PR fixes a problem in the FormTokenField component where tokens protrude from the input element when the cursor is moved between (or at the beginning of) tokens.

Before After
before.mp4
after.mp4

Why?

This is because this component does not have box-sizing:border-box. However, this problem does not occur in the sidebar of a post, for example, because the box-sizing is reset.

.edit-post-sidebar,
.editor-post-publish-panel,
.components-popover,
.components-modal__frame,
.edit-post-editor__inserter-panel {
@include reset;
}

@mixin reset {
box-sizing: border-box;
*,
*::before,
*::after {
box-sizing: inherit;
}
}

Testing Instructions

  • Launch Storybook.
  • Enter some tokens.
  • Press the left and right cursor keys.
  • Confirm that the tokens do not protrude from the input element.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Package] Components /packages/components labels Jul 16, 2023
@t-hamano t-hamano self-assigned this Jul 16, 2023
@t-hamano t-hamano requested review from ciampo and mirka July 16, 2023 15:33
@t-hamano t-hamano marked this pull request as ready for review July 16, 2023 15:33
@t-hamano t-hamano requested a review from ajitbohra as a code owner July 16, 2023 15:33
Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well, thanks!

@t-hamano t-hamano merged commit 643b7b8 into trunk Jul 18, 2023
@t-hamano t-hamano deleted the form-token-field/padding-overflow branch July 18, 2023 17:36
@github-actions github-actions bot added this to the Gutenberg 16.3 milestone Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants