-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Ui: preparation for HDS adoption to replace <Modal> #23353
Conversation
@@ -10,6 +10,7 @@ import Modifier from 'ember-modifier'; | |||
|
|||
import 'codemirror/addon/edit/matchbrackets'; | |||
import 'codemirror/addon/selection/active-line'; | |||
import 'codemirror/addon/display/autorefresh'; |
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.
[docs]
When a modal renders the JsonEditor
(ex: with the sample policy template) the content of JsonEditor doesn't render unless the element is focused. Previously we would wait to render the component by wrapping the element in an additional conditional, but this approach no longer works. Now codemirror will autorefresh if passed a @container
arg
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.
Do you think it would be necessary in scenarios other than in a modal where the container value is passed to set the autoRefresh
property? I'm guessing no since we haven't run into this until now and we could easily add a dedicated arg for autoRefresh
in the future if 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.
Yeah - that was my thinking. For now, it seemed okay to have autoRefresh rely on container. But since container could refer to a flyout, dropdown, or maybe even a card - we may want to separate the args in the future!
Build Results: |
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 the comments and investigation on this! LGTM
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.
LGTM 🎉
* * REQUIRED if rendering within a modal * | ||
* @container gives context for the <Hd::Copy::Button> and sets autoRefresh=true so JsonEditor renders content (without this property @value only renders if editor is focused) | ||
* @param {string} [container] - Selector string or element object of containing element, set the focused element as the container value. This is for the Hds::Copy::Button and to set autoRefresh=true so content renders https://hds-website-hashicorp.vercel.app/components/copy/button?tab=code | ||
* |
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.
Nice thanks for documenting this!
@@ -10,6 +10,7 @@ import Modifier from 'ember-modifier'; | |||
|
|||
import 'codemirror/addon/edit/matchbrackets'; | |||
import 'codemirror/addon/selection/active-line'; | |||
import 'codemirror/addon/display/autorefresh'; |
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.
Do you think it would be necessary in scenarios other than in a modal where the container value is passed to set the autoRefresh
property? I'm guessing no since we haven't run into this until now and we could easily add a dedicated arg for autoRefresh
in the future if needed.
Small changes to prepare for implementing the
<Hds::Modal>
component.Adds
@container
to the JsonEditor so copy buttons work inside modals, also moves overflow styling to.body