-
Notifications
You must be signed in to change notification settings - Fork 44
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
Hds::CodeEditor
Website updates
#2626
base: alex-ju/code-editor-codemirror-spike
Are you sure you want to change the base?
Hds::CodeEditor
Website updates
#2626
Conversation
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.
@majedelass Looking good! Left a few notes.
One thing that caught me off guard, though, was the sections for "Active line highlighting" and "Bracket highlighting." I don't know that they're necessary. They aren't guidelines the consumer should follow or options they can choose from, but examples of styling for functional embedded features. Do others think this should be documented within the guidelines?
description: A code editor with syntax highlighting, change history, and keyboard navigation. | ||
caption: A code editor with syntax highlighting, change history, and keyboard navigation. | ||
links: | ||
figma: https://www.figma.com/design/iweq3r2Pi8xiJfD9e6lOhF/HDS-Components-v2.0?node-id=67166-37020&t=w8xQlWxzH7bwXLe2-1 |
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.
@majedelass This will also need to be updated. It currently links to the CodeBlock page.
website/docs/components/code-editor/partials/guidelines/guidelines.md
Outdated
Show resolved
Hide resolved
website/docs/components/code-editor/partials/guidelines/guidelines.md
Outdated
Show resolved
Hide resolved
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.
Left mainly grammatical suggestions, but there are a couple of references to the component and some other cleanup items that should be consistent. LMK if you want to pair on the Code Block syntax highlighting color preview in the table.
|
||
### Contextual components | ||
|
||
#### [CB].Title |
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.
Should the contextual component be this instead? Maybe this is a result of copy-pasta from the CodeBlock?
#### [CB].Title | |
#### [CE].Title |
</C.Property> | ||
</Doc::ComponentApi> | ||
|
||
#### [CB].Description |
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.
Same question here
#### [CB].Description | |
#### [CE].Description |
|
||
<Doc::ComponentApi as |C|> | ||
<C.Property @name="yield"> | ||
Accepts complex content, such as logic/conditionals, HTML elements, other Ember components, etc. Content inherits its style. Styling is applied for simple HTML elements, such as `strong`, `em`, `a`, `code/pre`. Consumers will need to style other HTML tags if used as children |
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 personally had to re-read this a few times to grasp it, I think what was confusing me was "Content inherits its style", which is then followed by the rest of the styling information, which seems somewhat contradictory? I also could totally be misunderstanding this
Accepts complex content, such as logic/conditionals, HTML elements, other Ember components, etc. Content inherits its style. Styling is applied for simple HTML elements, such as `strong`, `em`, `a`, `code/pre`. Consumers will need to style other HTML tags if used as children | |
Accepts complex content, such as logic/conditionals, HTML elements, other Ember components, etc. Styling is applied for simple HTML elements, such as `strong`, `em`, `a`, `code/pre`. Consumers will need to style other HTML tags if used as children |
|
||
<Doc::ComponentApi as |C|> | ||
<C.Property @name="yield"> | ||
Accepts complex content, such as logic/conditionals, HTML elements, other Ember components, etc. Content inherits its style. Styling is applied for simple HTML elements, such as `strong`, `em`, `a`, `code/pre`. Consumers will need to style other HTML tags if used as children. |
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.
Same question about "Content inherits its style", if this is still relevant, feel free to disregard.
website/docs/components/code-editor/partials/guidelines/guidelines.md
Outdated
Show resolved
Hide resolved
website/docs/components/code-editor/partials/guidelines/guidelines.md
Outdated
Show resolved
Hide resolved
website/docs/components/code-editor/partials/guidelines/guidelines.md
Outdated
Show resolved
Hide resolved
website/docs/components/code-editor/partials/guidelines/guidelines.md
Outdated
Show resolved
Hide resolved
website/docs/components/code-editor/partials/specifications/anatomy.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Jory Tindall <[email protected]>
bab037d
to
17733cf
Compare
2e45538
to
6c4cbee
Compare
website/docs/components/code-editor/partials/guidelines/guidelines.md
Outdated
Show resolved
Hide resolved
|
||
This provides an accessible name for the Code Editor so that a user and assistive technology can understand its purpose. | ||
|
||
![A partial form with a radio group labeled with "Enforement behavior" and then the options "Advisory" with helper text "failed policies produce a warning", "Soft mandatory" with helper text "Failed policies can be overriden", "Hard mandatory" with helper text "Failed policies stop the run". Then the Code Editor with an external acessible name/title "Policy code (Sentinel)"](/assets/components/code-editor/code-editor-external-do-accessible-name.png) |
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.
Suggestion: We can shorten this up a bit.
![A partial form with a radio group labeled with "Enforement behavior" and then the options "Advisory" with helper text "failed policies produce a warning", "Soft mandatory" with helper text "Failed policies can be overriden", "Hard mandatory" with helper text "Failed policies stop the run". Then the Code Editor with an external acessible name/title "Policy code (Sentinel)"](/assets/components/code-editor/code-editor-external-do-accessible-name.png) | |
![A Code Editor embedded in a form following a set of radio buttons. It has the heading "Policy code (Sentinel)" immediately before.](/assets/components/code-editor/code-editor-external-do-accessible-name.png) |
|
||
!!! Do | ||
|
||
This provides an accessible name for the Code Editor so that a user and assistive technology can understand its purpose. |
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.
Suggestion: one important thing to know is that the accessible name is not provided by just having the text in the DOM. Either the code editor needs to have aria-label or have aria-labelledby set to the id of the title.
@zamoore set up aria-labelledby to work automatically if you use the CE title component, but it wont work if the title is custom.
|
||
Sometimes it may be necessary to use the Code Editor in a more dense layout or nested within another component. | ||
|
||
![Code Editor embedded inside of a larger UI, where it is highlighted where the user is actively editing.](/assets/components/code-editor/code-editor-block-level.png) |
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 Editor embedded inside of a larger UI, where it is highlighted where the user is actively editing.](/assets/components/code-editor/code-editor-block-level.png) | |
![Code Editor embedded inside of a logs UI, where the corners are squared to fit within container.](/assets/components/code-editor/code-editor-block-level.png) |
|
||
|
||
Assuming a user would understand the intent of the Code Editor without providing an accessible name will cause confusion and fail on accessibility requirements. | ||
![A partial form with a radio group labeled with "Enforement behavior" and then the options "Advisory" with helper text "failed policies produce a warning", "Soft mandatory" with helper text "Failed policies can be overriden", "Hard mandatory" with helper text "Failed policies stop the run". The Code Editor has no accessible name.](/assets/components/code-editor/code-editor-dont-external-accessible-name.png) |
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.
![A partial form with a radio group labeled with "Enforement behavior" and then the options "Advisory" with helper text "failed policies produce a warning", "Soft mandatory" with helper text "Failed policies can be overriden", "Hard mandatory" with helper text "Failed policies stop the run". The Code Editor has no accessible name.](/assets/components/code-editor/code-editor-dont-external-accessible-name.png) | |
![A Code Editor embedded in a form following a set of radio buttons. The Code Editor has no title before it.](/assets/components/code-editor/code-editor-dont-external-accessible-name.png) |
|
||
!!! Warning | ||
|
||
The Code Editor has limited support for dark mode styles. Buttons have pre-defined dark mode styles, but all other components require manual color adjustments until a dark mode theme is released. Please contact the Design Systems Team for help translating components into dark mode. |
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.
Suggestion: link to the contact page here
|
||
Some elements or functions outside the Code Editor may affect the content within the Code Editor. In this case, we recommend turning off the header to couple the editor with the nearby elements. | ||
|
||
![An external accessible name/title with a coupled search field, dropdown labeled with "Copy", another dropdown labeled with "Version" and a button labeled with "Create new version"](/assets/components/code-editor/code-editor-external-functions.png) |
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.
![An external accessible name/title with a coupled search field, dropdown labeled with "Copy", another dropdown labeled with "Version" and a button labeled with "Create new version"](/assets/components/code-editor/code-editor-external-functions.png) | |
![A Code Editor with the external title "Automations and expressions" coupled with a filter input, "Copy" dropdown, "Version" dropdown, and a "Create new version" button.](/assets/components/code-editor/code-editor-external-functions.png) |
|
||
When a user is editing code on a single line, a highlight will be present to emphasize their location in the Code Editor. | ||
|
||
![The Code Editor's line 1 with the active line highlight.](/assets/components/code-editor/code-editor-code-active-line.png) |
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.
![The Code Editor's line 1 with the active line highlight.](/assets/components/code-editor/code-editor-code-active-line.png) | |
![The Code Editor's line 1 with the active line highlight, shown with a blinking cursor and border around the entire line.](/assets/components/code-editor/code-editor-code-active-line.png) |
### Applying syntax highlighting | ||
|
||
If you wish to create custom examples using the Code Editor, we publish all of the relevant syntax highlighting variables in the [HDS Components v2.0](https://www.figma.com/design/iweq3r2Pi8xiJfD9e6lOhF/HDS-Components-v2.0?node-id=67166-37020&t=gWdKy44MzTP4cTRo-1) library. However, due to the number of languages supported by the component, the color variables use a generic naming schema (e.g., cyan, red, purple) to remain as agnostic as possible when being applied to different languages. | ||
For more details around syntax visit the [specifications](https://helios.hashicorp.design/components/code-editor?tab=specifications). |
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 this should work
For more details around syntax visit the [specifications](https://helios.hashicorp.design/components/code-editor?tab=specifications). | |
For more details around syntax visit the [specifications](/components/code-editor?tab=specifications). |
@@ -0,0 +1,29 @@ | |||
## Anatomy | |||
|
|||
![Anatomy of Code Editor](/assets/components/code-editor/code-editor-anatomy.png) |
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.
![Anatomy of Code Editor](/assets/components/code-editor/code-editor-anatomy.png) | |
![](/assets/components/code-editor/code-editor-anatomy.png) |
π Summary
If merged, this PR will add Website documentation for the new
Hds::CodeEditor
component added in #2573.π οΈ Detailed description
TBD
πΈ Screenshots
TBD
π External links
Jira ticket: HDS-4311
π¬ Please consider using conventional comments when reviewing this PR.