Skip to content

Conversation

@amyleadem
Copy link
Contributor

@amyleadem amyleadem commented Jun 6, 2023

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.

⚠️ We need to update the changelog date before merge.

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.responsive in 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:

@use "uswds-core" with (
  $background-color-settings.responsive: true,
);

Instead, the configuration would need to look like this:

@use "uswds-core" with (
  $background-color-settings: (
      responsive: true,
    )
);

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

  1. Confirm that the note conveys intended meaning and is placed in the appropriate location on site.
  2. Confirm there are no spelling or grammatical errors.

{:.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}
Copy link
Contributor Author

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.

@amyleadem amyleadem marked this pull request as ready for review June 6, 2023 17:02
Copy link
Contributor

@mahoneycm mahoneycm left a 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!

!

```

{:.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`.
Copy link
Contributor

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:

Suggested change
**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`.

Copy link
Contributor Author

@amyleadem amyleadem Jun 6, 2023

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.

Copy link
Contributor

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?

Copy link
Contributor Author

@amyleadem amyleadem Jun 15, 2023

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.
⚠️ @thisisdano, is it ok to use a resource like this?

Update: This question is no longer relevant because we removed the link altogether.

Copy link
Contributor

@bonnieAcameron bonnieAcameron left a 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.

@amyleadem amyleadem linked an issue Jun 8, 2023 that may be closed by this pull request
2 tasks
Base automatically changed from release-3.5.0 to main June 9, 2023 23:09
Amy Leadem added 4 commits June 15, 2023 07:08
@amyleadem
Copy link
Contributor Author

@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!

@amyleadem amyleadem requested a review from bonnieAcameron June 15, 2023 17:54
Copy link
Contributor

@bonnieAcameron bonnieAcameron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, Amy!

@amyleadem amyleadem requested a review from thisisdano June 15, 2023 19:54
Copy link
Contributor

@mejiaj mejiaj left a 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.

image

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?

Amy Leadem added 4 commits July 7, 2023 12:44
- 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
Comment on lines +57 to +58
{: .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.
Copy link
Contributor Author

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
Copy link
Contributor Author

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)

Comment on lines +137 to +145
```scss
@use "uswds-core" with (
$theme-namespace: (
grid: (
namespace: "custom-grid-name-",
)
)
);
```
Copy link
Contributor Author

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 that grid.namespace lives inside of $theme-namespace based 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.

Copy link
Contributor

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!

@amyleadem amyleadem requested a review from mejiaj July 10, 2023 16:17
@amyleadem
Copy link
Contributor Author

@mejiaj
cc: @bonnieAcameron @mahoneycm
Thanks for the helpful notes. I made a few edits based on your comment:

  1. Reorganized content a bit to improve flow
    1. Moved the dot notation section to live directly above the settings tables
    2. Moved the compilation error message site note up into the "What to include in your configuration" section
    3. Nested "Configuring settings maps" inside "What to include in your configuration"
  2. Changed the code example in the dot notation section to use a selection from the settings tables
  3. Removed site note styling from the dot notation section so that I could add a larger code snippet

Curious to hear what you all think!

Copy link
Contributor

@mejiaj mejiaj left a 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!

Copy link
Contributor

@mahoneycm mahoneycm left a 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!

Comment on lines +137 to +145
```scss
@use "uswds-core" with (
$theme-namespace: (
grid: (
namespace: "custom-grid-name-",
)
)
);
```
Copy link
Contributor

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!

@thisisdano thisisdano merged commit 995b9cc into main Jul 28, 2023
@thisisdano thisisdano deleted the al-dot-notation branch July 28, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

USWDS-Site - Compile: Clarify dot notation for nested settings

6 participants