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
Gutenboarding: Fix "Choose a domain I own" layout on mobile #49249
Gutenboarding: Fix "Choose a domain I own" layout on mobile #49249
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~2 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
@@ -92,6 +92,9 @@ button.action_buttons__button.components-button { | |||
font-weight: 500; | |||
color: var( --mainColor ); | |||
|
|||
// @TODO: We have to revisit the ArrowButton's padding when we pick up #48568 (https://github.com/Automattic/wp-calypso/issues/48568) | |||
padding-left: 0; |
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.
Just leaving this comment here to mark the TODO item
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.
Thank you for improving the layout! It looks much better on mobile now :)
I left some comments, and here's some additional feedback from my first round of review:
- Can we improve the vertical alignment of text and arrow?
- Can we align the "Use a domain I own >" button to the right, similarly to the items above?
- While following the testing instructions, whenever I click and get redirected, the query params in the "redirected" URL are different from the testing instructions (maybe you just forgot to update them?):
- From gutenboarding, I got redirected to
/start/domains/use-your-domain?source=http://calypso.localhost:3000/new/domains
- From Focused Launch, I got redirected to
https://wordpress.com/start/new-launch/domains-launch/use-your-domain?siteSlug=teststart366187286.wordpress.com&source=http://calypso.localhost:3000/page/teststart366187286.wordpress.com/home?flags=create/focused-launch-flow
— note that I got redirected to wordpress.com, even though I was testing on my local machine, and that thesource
query param contains the full URL (and not just the path)
- From gutenboarding, I got redirected to
<label className="domain-picker__suggestion-item contains-link"> | ||
/* eslint-disable jsx-a11y/click-events-have-key-events */ | ||
/* eslint-disable jsx-a11y/interactive-supports-focus */ | ||
<div role="button" className="domain-picker__suggestion-item type-link" onClick={ onClick }> |
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 looks very hacky (and it looked hacky as well prior to this PR).
- Why are we not using a
<button />
? Is it because there's another<button />
nested inside? - In general, nesting interactive HTML elements within each other (e.g button inside a label, or button inside a button) goes against the HTML spec
- We may want to consider that the rest of the domain suggestion items have a different wrapping HTML element based on a prop — should we have this component behave the same way, so that it's always aligned with the rest of the items?
Absolutely and thanks for addressing this 👍 I've updated the component by aligning the icon with the copy's baseline w/ a negative margin since the
Sure! I've updated the component.
I've updated the testing instructions. |
I started testing and noticed that on mobile the "Use a domain I own" button doesn't align correctly to the left Also, what do you think about #49249 (comment)? |
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.
Code changes LGTM, tests as per instructions — although https://github.com/Automattic/wp-calypso/pull/49249/files#r564448003? It hasn't been addressed yet.
@StefanNieuwenhuis what do you think? I understand that it's outside the scope of this PR, but at the very minimum we should discuss it and/or open a separate issue about it
Thanks for reviewing & approving! |
Be more explicit when it comes to `flexbox`. Co-authored-by: Marco Ciampini <marco.ciampini@automattic.com>
The current semantics was a bit hacky and unaligned with the other domain suggestions, which are wrapped in a (surprise, surprice) wrapper component. To wrap our component, the wrapper is abstracted from the suggestion-item and moved to a seperate file.
3534764
to
717ae15
Compare
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.
const WrappingComponent = React.forwardRef< HTMLButtonElement, WrappingComponentProps >( | ||
( { type, disabled, ...props }, ref ) => { | ||
if ( type === 'button' ) { | ||
return <div { ...( props as React.HTMLAttributes< HTMLDivElement > ) } />; | ||
} | ||
return ( | ||
<button | ||
ref={ ref } | ||
disabled={ disabled } | ||
{ ...( props as React.ButtonHTMLAttributes< HTMLButtonElement > ) } | ||
/> | ||
); | ||
} | ||
); |
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 still not a fan of the markup that this component outputs. Also, it's confusing that when type === button
, the HTML element returned is a div
.
We should open a follow-up issue to investigate the semantics of the domain picker a bit better, given all of its variations, and come up with more accessible markup/semantics.
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.
Created #49462
Changes proposed in this Pull Request
The copy of the "Choose a domain I own" row on the Domain Picker is unreadable on mobile devices because the CTA-link is on the same row. This PR contains a fix that stacks (i.e. placed on separate rows) both on mobile viewports.
Technical changes
<label/>
to<div/>
) to align with the solution provided in the/start
flow.<ArrowButton/>
. We have to revisit this while working on Focused Launch: Replace "Back" buttons with ButtonArrow onboarding component #48568.Expected Result
Mobile
Desktop
Testing instructions
Gutenboarding
/new/domains-modal
iPhone X
)./new/domains-modal
.Focused Launch
/page/[UNLAUNCHED_SITE_ID].wordpress.com/home?flags=create/focused-launch-flow
.iPhone X
)./page/[UNLAUNCHED_SITE_ID].wordpress.com/home?flags=create/focused-launch-flow
.Fixes #49171