-
Notifications
You must be signed in to change notification settings - Fork 2k
Language Switcher: Replace custom Dialog component with the core Modal. #103503
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
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~31 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~14 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~349 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. 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. |
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
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.
Tested and it works! Left some code comments below.
flex:none; | ||
flex-direction: column; | ||
width: 100%; | ||
>div:nth-child(2) { |
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 are we targeting with this? Can we add a comment, or is there another way to be more explicit/clear? 🤔
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've added a comment, unfortunately, there's no easy way to add a class to the Modal HTML structure.
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.
Heya. Replied below - #103503 (comment)
Let me know if you'll be confirming that, otherwise happy to explore further myself. :)
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.
Yep, I'm currently addressing the reported issues.
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.
Sounds good. Happy to review any additional changes.
display:flex; | ||
flex:none; | ||
flex-direction: column; | ||
width: 100%; |
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.
Sorry for naive question. Are these effective/needed?
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.
Thanks, with flex:none not being needed, I've removed the three instructions.
Seems to be a leftover from my previous attempt.
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 wonder if removing any of these caused the breakage in #103503 (comment)
display:flex; | ||
/* Targeting the content div, we can't alter the HTML of the modal itself */ | ||
>div:nth-child(2) { | ||
height: 100%; |
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.
Does height: 100%
have any actual effect right now?
Sorry for my questions. CSS is not trivial to maintain.
margin-top: 24px; | ||
display:flex; | ||
/* Targeting the content div, we can't alter the HTML of the modal itself */ | ||
>div:nth-child(2) { |
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.
In general, I think the more we can avoid referencing internal structures of external components, the better. These may change, even the core class names may change e.g. components-modal__content
.
In this case, it looks we can achieve the same effect by wrapping the content we pass to the modal and target that instead, e.g.
<div className="language-picker__modal-content">
<LanguagePicker
headingTitle={ __( 'Select a language' ) }
languages={ languages }
languageGroups={ createLanguageGroups( __ ) }
onSelectLanguage={ setSelectedLanguage }
selectedLanguage={ selectedLanguage }
localizedLanguageNames={ localizedLanguageNames }
/>
<div>{ buttons }</div>
</div>
Targeting language-picker__modal-content
would be safe(r).
But pls confirm. I only briefly tested.
We can drill into the need to even reference components-modal__content
separately. That may be able to go away too.
Thanks for the report @chriskmnds, I'm currently addressing the issues, will have a PR up soon. |
Fixes DOTCOM-12873
Proposed Changes
Replace the
Dialog
component with the core'sModal
.Why are these changes being made?
The previous modal was unnecessarily large.
Before:

After:

Testing Instructions
/me/account
, open the language switcher modal, and confirm it works correctly.Pre-merge Checklist