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

TimePicker: Layout breaks when the timezone string is long #56257

Open
afercia opened this issue Nov 17, 2023 · 3 comments
Open

TimePicker: Layout breaks when the timezone string is long #56257

afercia opened this issue Nov 17, 2023 · 3 comments
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Nov 17, 2023

Description

Splitting this out from #56211 (comment)

The TimePicker renders a Spacer component between the AM/PM buttons and the timezone indication.

I would argue that a component should not render a Spacer, which is a presentational component. Presentation should be kept separate from funcitonality.

Anyways, when the timezone indication is a little longer than usual, e.g. UTC+5.75, th elayout breaks and the AM/PM buttons get stacked vertically. Note: the displayed value 5.75 is wrong. I created #56254 to address that.

Screenshot:

Screenshot 2023-11-17 at 15 23 37

Step-by-step reproduction instructions

  • Go to the WordPress admin Settings > General Settings > Timezone.
  • Set the Timezone value to UTC+5:45 and save.
  • Go to the post editor and publish a new post.
  • Click the Publish date in the settings panel.
  • The Publish popover appears.
  • Observe the AM/PM buttons leyout is broken.
  • Observe there is enough space to display the longer timezone value but the layout breaks regardless.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@afercia afercia added [Type] Bug An existing feature does not function as intended [Package] Components /packages/components CSS Styling Related to editor and front end styles, CSS-specific issues. labels Nov 17, 2023
@afercia
Copy link
Contributor Author

afercia commented Nov 17, 2023

Noting that this can't be reproduced any longer after #56196

But: I think the changes from #56196 should be adjusted a bit, so I'd keep this open for now.

@mirka
Copy link
Member

mirka commented Dec 15, 2023

What is the desired layout tweak here? We could for example flex-wrap it so it goes to the next line when the width is too narrow.

Long timezone string is flex-wrapped to the next line

But if the max possible length of the timezone string is not that long, it's more about tweaking the width of whatever container the consumer is putting TimePicker in. (TimePicker itself does not have width constraints.)

@afercia
Copy link
Contributor Author

afercia commented Dec 21, 2023

But if the max possible length of the timezone string is not that long, it's more about tweaking the width of whatever container the consumer is putting

Yes, the timezone string can contain max 2 numbers (minutes) after a colon. I think it's more about removing the spacer between AM/PM and the timezone. That spacer is unnecessary and it's responsible for the breakage. For example, the timezone could use a left margin auto to be right aligned and the spacer be entirely removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Styling Related to editor and front end styles, CSS-specific issues. [Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants