-
Notifications
You must be signed in to change notification settings - Fork 879
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
Tweak SnippetPreview #21469
base: feature/plugin-fixes
Are you sure you want to change the base?
Tweak SnippetPreview #21469
Conversation
Reasoning: mobile users drag instead of scroll
Needed to be able to influence the fixed width background color * using the given className extended with `__wrapper` * add fallback for the className: fallback to the ID * add className (same as the ID) to the FixedWidthContainer used in the SnippetPreview
For ease of development
In the current font size: by 3px
Making it possible to change the padding via CSS by checking the offsetWidth and comparing it against the scrollWidth. This assumes the max-width and overflow remain in effect!
@@ -111,12 +111,13 @@ export default class FixedWidthContainer extends Component { | |||
render() { | |||
const { width, padding, children, className, id } = this.props; | |||
|
|||
const klass = className || id; |
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 klass = className || id; | |
const classNameOrId = className || id; |
const innerWidth = width - 2 * padding; | ||
|
||
return <React.Fragment> | ||
return <div className={ `${ klass }__wrapper` }> |
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.
return <div className={ `${ klass }__wrapper` }> | |
return <div className={ `${ classNameOrId }__wrapper` }> |
<FixedWidth | ||
id={ id } | ||
className={ className } | ||
className={ klass } |
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.
className={ klass } | |
className={ classNameOrId } |
this.setState( { | ||
showScrollHint: width < this.props.width, | ||
showScrollHint: this._container?.offsetWidth !== this._container?.scrollWidth, | ||
isMobileUserAgent: window?.navigator?.userAgent?.includes( "Mobi" ), |
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.
What about a case insensitive check?
Context
Summary
This PR can be summarized in the following changelog entry:
width
prop is larger than the currentwidth
.yarn watch
command for ease of development.Relevant technical choices:
Mobi
, to determine if on a mobile device. Not sure what else to use whenuserAgentData
is not fully supported (see https://caniuse.com/?search=navigator.userAgentData). I sawmaxTouchPoints
being suggested (see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/maxTouchPoints), I'm not sure.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
New copy
Drag to view the full preview.
Scroll to see the preview content.
Regression tests
DEV only: yarn watch
yarn workspace @yoast/search-metadata-previews watch
, or runyarn watch
in thepackages/search-metadata-previews
folderpackages/search-metadata-previews
yarn start
in the root), you would see the change on refresh of the pageRelevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes https://github.com/Yoast/ux/issues/140