-
Notifications
You must be signed in to change notification settings - Fork 199
USWDS-Site: Add note about settings with dot notation #2122
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
pages/documentation/settings.md
Outdated
| {:.site-note.radius-bottom-0} | ||
| **Note:** We use dot notation to describe settings that are nested inside a Sass map. For example, for the code sample above, `$background-color-settings.responsive` would refer to the `responsive` property inside `$background-color-settings`. | ||
|
|
||
| {:.site-note.margin-top-0.radius-top-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.
Note: I contemplated creating a style that would visually merge two site-note items that directly follow each other, with the goal of allowing multiple elements to combine into a single site note. However, I opted for utility classes instead because of the chance that we might want two separate site-notes adjacent siblings.
mahoneycm
left a 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.
Love this change! I was worried about users misunderstanding this before. Thanks for taking the time to come up with this!
!
pages/documentation/settings.md
Outdated
| ``` | ||
|
|
||
| {:.site-note.radius-bottom-0} | ||
| **Note:** We use dot notation to describe settings that are nested inside a Sass map. For example, for the code sample above, `$background-color-settings.responsive` would refer to the `responsive` property inside `$background-color-settings`. |
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 think we should describe the environment in which we use the dot notation as well as potentially link out to a resource that tells them more about it. So then it would be like:
| **Note:** We use dot notation to describe settings that are nested inside a Sass map. For example, for the code sample above, `$background-color-settings.responsive` would refer to the `responsive` property inside `$background-color-settings`. | |
| **Note:** We use [dot notation](https://builtin.com/data-science/dot-notation) in most of our documentation to describe settings that are nested inside a Sass map. For example, for the code sample above, `$background-color-settings.responsive` would refer to the `responsive` property inside `$background-color-settings`. |
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.
@bonnieAcameron I like this suggestion! Wondering if a simpler link might be more appropriate for this since users don't really need to understand any of the whys or hows for using it - they just need to know what it is and that we use it in our docs. A possible substitute: (Chose MDN because we use it as a source elsewhere on the site)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors
Happy to defer to your expertise.
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 @amyleadem! I guess my only concern is that they don't know that they don't need to know the hows and whys. The MDN link provides a circular definition (using a word to define itself). Is there another source we regularly reference?
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.
Note:
After an offline discussion with @bonnieAcameron, I have added this link as a resource in case users want to learn more about what dot notation is.
I looked at MDN and other more expected resources, but could not find a simple definition.
Update: This question is no longer relevant because we removed the link altogether.
bonnieAcameron
left a 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.
Hi @amyleadem Amy! I made a comment with suggestions. Let me know what you think.
- Make small tweaks to dot notation copy
- Make this a section easier to find via screen readers, etc
|
@bonnieAcameron I have added a resource link as we discussed and made a few small copy tweaks in a6cf618 and cfdaaf4. I decided to add an h4 header in 789c472 with the idea that it might make the section easier to find for users with screen readers, since it explains an important piece of our docs. Let me know what you think! |
bonnieAcameron
left a 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.
Looks great, Amy!
mejiaj
left a 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.
Some concerns with this guidance:
Note placement
It seems too detached from a realistic example. The note mentioned about $background-color-settings can seem confusing.
From what I understand, we're adding this guidance to explain the use of dot notation in the table right? If so, it'd make sense to move it closer.
Dot notation guidance
Is there any way we can paraphrase or provide our own explanation? I'd rather avoid another potential 404/403 issue if/when the author decides to modify the URL.
Note formatting
I noticed this morning our site notes are inconsistent and created this issue for it USWDS-Site - Bug: Inconsistent site notes #2164. This adds another style/variant to it. Could we revert back to using the standard formatting?
- Moved 'What to include' up to provide basic config info sooner - Mover error note higher to be closer to related content - Moved dot notation section closer to settings tables - Improved clarity of content in dot notation section - Removed site note styles to accommodate longer text and code sample
| {: .site-note } | ||
| **Note:** If you receive the error `This module was already loaded, so it can't be configured using "with"`, confirm that all your declared variables exist in the [settings tables](#general-settings) and try compiling again. |
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.
Note
Moved this error note up higher because it seemed directly related to this section
| Note that the settings variables in this module inform both general theme and component customizations. | ||
|
|
||
| ### Configuring settings maps | ||
| ### What to include in your configuration |
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.
Note
Reorganized this content a bit to help with flow. The page started to feel a bit disjointed after a few rounds of additions (including this one)
| ```scss | ||
| @use "uswds-core" with ( | ||
| $theme-namespace: ( | ||
| grid: ( | ||
| namespace: "custom-grid-name-", | ||
| ) | ||
| ) | ||
| ); | ||
| ``` |
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.
Note
Added a code sample here because it didn't feel immediately clear thatgrid.namespacelives inside of$theme-namespacebased on the info in the settings tables. I thought that adding a code example would show the multiple levels of nesting in these types of settings.
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 is so very clear, and I could understand it easily as someone new to this process. Lovely!
|
@mejiaj
Curious to hear what you all think! |
mejiaj
left a 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.
Looks great, thanks for updating this!
mahoneycm
left a 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.
Very understandable! This will be helpful for newcomers to the system to understand how to update their settings.
Thanks Amy!
| ```scss | ||
| @use "uswds-core" with ( | ||
| $theme-namespace: ( | ||
| grid: ( | ||
| namespace: "custom-grid-name-", | ||
| ) | ||
| ) | ||
| ); | ||
| ``` |
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 is so very clear, and I could understand it easily as someone new to this process. Lovely!

Summary
Added a section about configuring settings that are described using dot notation.
Additionally, reordered the "What to include in your configuration" content and the compilation error note in order to improve flow.
Related issue
Closes #2116
Preview link
Preview link: Settings page
Problem statement
On our site, we use dot notation to describe settings that are nested inside a settings map. For example: we refer to
$background-color-settings.responsivein our utilities documentation. This can lead to confusion when users try to configure this setting, because you cannot include the following in your USWDS configuration:Instead, the configuration would need to look like this:
Solution
Adding a note about dot notation next to the settings map configuration will help guide users to understand how to configure a setting described in dot notation.
Testing and review