Visitar URL original
USWDS-Site - Utility settings: Update maps instructions under state and responsive variants by mahoneycm · Pull Request #2077 · uswds/uswds-site · GitHub
Skip to content

USWDS-Site - Utility settings: Update maps instructions under state and responsive variants - #2077

Merged
thisisdano merged 23 commits into
release-3.5.0from
cm-update-sass-map-instructions
May 31, 2023
Merged

thisisdano merged 23 commits into
release-3.5.0from
cm-update-sass-map-instructions

Conversation

@mahoneycm

@mahoneycm mahoneycm commented May 1, 2023 •

Copy link
Copy Markdown
Contributor

Summary

Update sass map instructions under utility state and responsive variant sections. Instructions match pattern introduced in uswds/uswds#5216

Related issue

Closes #2076

Preview link

Configure settings maps | Settings page →

Utilities settings →

Responsive + State variants →

Problem statement

  1. The updated sass map pattern allows users to only update settings they want to change. All others maintain default values set by USWDS.
  2. The existing instructions told users they had to define all map elements and not just the elements they wish to change.

Solution

Update documentation to match the new pattern. The new instructions read:

When modifying any settings stored as a map, undefined elements of the map will take its default value.

Testing and review

  1. Visit any utility page with responsive & state variants, such as color
  2. Read instructions under responsive & state variants.
  3. Confirm they have been updated with the new pattern instruction.
  4. Confirm instructions are clear & concise.

Further consideration

This update only updates existing map instructions. I think it might be beneficial to users to add additional sass map instructions on the settings and utilities pages.

Before opening this PR, make sure you’ve done whichever of these applies to you:

  • Confirm that this code follows the 18F Front End Coding Style Guide and Accessibility Guide.
  • Run git pull origin [base branch] to pull in the most recent updates from your base and check for merge conflicts. (Often, the base branch is main).
  • Run npm test and confirm that all tests pass. // Waiting for snyk update

@amyleadem amyleadem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for making these updates, @mahoneycm. Did some thinking and I agree that it would be beneficial to add settings map configuration instructions to both the settings and utilities pages. A few thoughts:

  • We could show a sample map configuration in the configuration example found in “Configuring custom USWDS settings” on the settings page.

  • We could add a few sentences to the settings page about configuring settings maps in USWDS. Here is a possible example that could live inside “What to include in your Sass configuration” :

    Configuring settings maps

    Similar to single-value settings, when configuring Sass settings maps in USWDS, you will only need to include the map items you wish to customize. Any item that is not defined in your configuration will keep its default value.

  • We could add a note to the "settings" section of the utilities page that points users to “Configuring custom USWDS settings” in the settings page.

  • If we do this, we should be able to safely remove the instructions on the responsive and state variants sections on the utility pages. I’ve provided examples in the comments.

Additionally, can you add changelog entries to both the settings and utilities (overview) pages?

I performed the following checks:

Comment thread _includes/utilities/responsive-variants.html
<p class="utility-text margin-top-4">Set whether a utility family outputs with responsive variants by setting the value of <code>$[utility_family]-settings.responsive</code> in your <a href="{{ site.baseurl }}/documentation/settings">USWDS settings configuration</a>. When modifying any settings stored as a map, undefined elements of the map will take its default value.</p>

<div class="example border-left-05 border-secondary-light padding-left-105 margin-top-2 margin-bottom-2">
<pre class=" font-mono-xs margin-0 padding-0 bg-transparent">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wondering if it might add clarity if we update the $background-color-settings configuration example below to show customizations for just one or two items, rather than the full map. It feels like it would be more illustrative of a real-world example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I like this example. Do you think we should include a second map of the output to illustrate that the default values are kept, or is that overkill? Something like:

Example:

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

Output:

$background-color-settings-complete: (
      output: true,
      responsive: false,
      active: false,
      focus: true,
      hover: false,
      visited: false,
    )

@amyleadem amyleadem May 11, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mahoneycm I don't think it is necessary, at least not at this time. My sense is that the update you have made in this PR creates the more intuitive behavior, so users likely won't need it to be explained in detail.

If we start to see questions pop up about it, we can look into adding more detail and clarity.

Curious to hear other viewpoints on this though!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tend to lean toward providing more context in these situations, but I agree that the new pattern is more intuitive so might be unnecessary. Do you think that it might be helpful to previous users who are used to defining the entire map? Part of me thinks it adds context so that users better understand what their end result is.

I pushed it up in my latest changes before I saw this comment. Take a peek and let me know if you think it's unnecessary!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is helpful to see it implemented. Thanks!
I still vote for not including it. Now that I see it I also worry about the possible confusion related to showing them $background-color-settings-complete. Do they need to know that the -complete sibling settings exist? What if it accidentally leads the users to configure the -complete variables instead?

My stance is we can always add it later.

Happy to defer to the group though! @mejiaj Do you have any thoughts on this?

@amyleadem amyleadem May 25, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI - I added a comment to the settings page to help explain my stance and reasoning on this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with @amyleadem's position here

Comment thread _includes/utilities/state-variants.html
@mahoneycm

Copy link
Copy Markdown
Contributor Author

Change log items added to Settings and Utilities pages 👍

@amyleadem amyleadem left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mahoneycm I added some comments and suggestions. Let me know if you have any questions - the comments got a bit jumbled, so I'm happy to get on a call to discuss if needed.

Comment thread pages/documentation/settings.md Outdated
Comment thread pages/documentation/settings.md
Comment thread pages/documentation/settings.md
Comment thread pages/documentation/settings.md Outdated
Comment thread _utilities/overview.md Outdated
Comment thread _data/changelogs/docs-settings.yml Outdated
Comment thread _data/changelogs/docs-settings.yml
Comment thread _data/changelogs/docs-settings.yml Outdated
Comment thread _data/changelogs/docs-settings.yml Outdated
Comment thread _includes/utilities/state-variants.html Outdated
mahoneycm and others added 13 commits May 26, 2023 12:25
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
Comment thread _utilities/overview.md
You can further customize utility output with USWDS settings. Add settings from the table below to your `uswds-core` module initialization. Here's an example:
You can further customize utility output with USWDS settings. Add settings from the table below to your `uswds-core` module initialization. For more information on configuring USWDS settings, visit the [settings page]( {{ site.baseurl }}/documentation/settings#configuring-settings-maps). Here's an example:

{:.site-terminal.margin-bottom-4}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removed for code example consistency

Comment thread _utilities/overview.md

Include the `uswds-utilities` package in your project's Sass entry point with a module forward:

{:.site-terminal}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removed for code example consistency

Comment thread _utilities/overview.md
Comment on lines -117 to -122
"output": true
"responsive": false
"active": false
"focus": false
"hover": false
"visited": false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Edited to show only the changed map setting

@thisisdano
thisisdano changed the base branch from main to release-3.5.0 May 26, 2023 21:37
@thisisdano

thisisdano commented May 26, 2023 •

Copy link
Copy Markdown
Contributor

Changed the base to release-3.5.0 so we can merge all the 3.5.0 changes at the same time

@amyleadem amyleadem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mahoneycm Thanks for all your work on this! I found a couple more small items for you. Will you take a look and let me know if you have questions?

Comment thread _data/changelogs/docs-settings.yml Outdated
- date: NNNN-NN-NN
summary: Updated sass map instructions to reflect new pattern.
summaryAdditional: Users are now instructed to define only the variable they wish to change instead of having to define the entire map
isBreaking: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be good if PR uswds/uswds#5216 had some details about what could break and how users can fix it. Can you update the description in that PR with some more info?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the Breaking Change section with the following:

Previously, if a user left an item out of a map, it would be set to false and thus deactivating it. After this update, an item left out of the map will maintain its default value.

If users deactivated certain settings by not declaring them, this update will cause those variables to be activated. Note that we did not recommend that pattern, but it's possible for users to have done so on their own

Comment thread _data/changelogs/docs-settings.yml Outdated
Comment thread _utilities/overview.md Outdated
Comment thread _includes/utilities/responsive-variants.html
mahoneycm and others added 2 commits May 30, 2023 13:14
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
mahoneycm and others added 2 commits May 30, 2023 14:56
Co-authored-by: Amy Leadem <93996430+amyleadem@users.noreply.github.com>
@mahoneycm
mahoneycm requested a review from amyleadem May 30, 2023 19:15
Comment thread _data/changelogs/utilities.yml Outdated

@amyleadem amyleadem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved!

@thisisdano
thisisdano merged commit 1feb86f into release-3.5.0 May 31, 2023
@thisisdano
thisisdano deleted the cm-update-sass-map-instructions branch May 31, 2023 22:47
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.

Update sass map settings instructions to match new pattern

3 participants