Skip to content
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

[SPIKE] Add parent prefixes to nested component options #2892

Closed
wants to merge 1 commit into from

Conversation

colinrotherham
Copy link
Contributor

@colinrotherham colinrotherham commented Jul 3, 2023

Morning 👋

I noticed last week that we sometimes "dot-prefix" nested option names with the associated parent or component:

Nested options with prefixes

For example Accordion summary.text and summary.html are NOT shown as nested options. Perhaps for readability, does the prefix visually help the nested option link together with the parent it belongs to?

Nested options with prefix

Nested options without prefixes

But there are many more examples where we don't benefit from "dot-prefix" clarity in our docs, should we add them?

For example the nested hint option in the image below. It's easy to lose context, especially when html and text options and descriptions are frequently duplicated elsewhere on examples pages

Nested options without prefix

For comparison, here's (hopefully) a complete list of all the options we don't "dot-prefix":

Character count

  1. formGroup.classes
  2. label.text
  3. label.html
  4. label.for
  5. label.isPageHeading
  6. label.classes
  7. label.attributes
  8. hint.text
  9. hint.html
  10. hint.id
  11. hint.classes
  12. hint.attributes

Checkboxes

  1. conditional.html
  2. formGroup.classes
  3. label.text
  4. label.html
  5. label.for
  6. label.isPageHeading
  7. label.classes
  8. label.attributes
  9. hint.text
  10. hint.html
  11. hint.id
  12. hint.classes
  13. hint.attributes

Date input

  1. formGroup.classes
  2. hint.text
  3. hint.html
  4. hint.id
  5. hint.classes
  6. hint.attributes

File upload

  1. formGroup.classes

Input

  1. suffix.text
  2. suffix.html
  3. suffix.classes
  4. suffix.attributes
  5. formGroup.classes
  6. label.text
  7. label.html
  8. label.for
  9. label.isPageHeading
  10. label.classes
  11. label.attributes
  12. hint.text
  13. hint.html
  14. hint.id
  15. hint.classes
  16. hint.attributes

Radios

  1. conditional.html
  2. formGroup.classes
  3. label.text
  4. label.html
  5. label.for
  6. label.isPageHeading
  7. label.classes
  8. label.attributes
  9. hint.text
  10. hint.html
  11. hint.id
  12. hint.classes
  13. hint.attributes

Select

  1. formGroup.classes
  2. label.text
  3. label.html
  4. label.for
  5. label.isPageHeading
  6. label.classes
  7. label.attributes
  8. hint.text
  9. hint.html
  10. hint.id
  11. hint.classes
  12. hint.attributes

Textarea

  1. formGroup.classes
  2. label.text
  3. label.html
  4. label.for
  5. label.isPageHeading
  6. label.classes
  7. label.attributes
  8. hint.text
  9. hint.html
  10. hint.id
  11. hint.classes
  12. hint.attributes

Summary list

  1. title.text
  2. title.html
  3. title.headingLevel
  4. title.classes

Task list

  1. card.title
  2. card.actions
  3. card.classes
  4. title.text
  5. title.html
  6. title.headingLevel
  7. title.classes

Nested options with automatic prefixes

This spike PR updates nested options to add parent prefixes automatically

Nested options without prefixes, but given prefixes

@colinrotherham colinrotherham added the documentation User requests new documentation or improvements to existing documentation label Jul 3, 2023
@netlify
Copy link

netlify bot commented Jul 3, 2023

You can preview this change here:

Name Link
🔨 Latest commit c5a5238
🔍 Latest deploy log https://app.netlify.com/sites/govuk-design-system-preview/deploys/6526b9395c1dda000821a574
😎 Deploy Preview https://deploy-preview-2892--govuk-design-system-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@colinrotherham colinrotherham force-pushed the nested-option-formatting branch 2 times, most recently from ccda791 to 7b5958e Compare July 3, 2023 12:55
@colinrotherham colinrotherham force-pushed the nested-option-formatting branch from 7b5958e to 553d5a1 Compare July 3, 2023 13:45
@colinrotherham colinrotherham self-assigned this Jul 5, 2023
@colinrotherham colinrotherham changed the title Use parent prefixes for nested component options [SPIKE] Add parent prefixes to nested component options Jul 6, 2023
@colinrotherham
Copy link
Contributor Author

@Izabela-16
Copy link
Contributor

not a priority but needs team decision

@colinrotherham colinrotherham added design website Issues relating to the Design System website itself labels Aug 3, 2023
@colinrotherham colinrotherham changed the base branch from main to option-table-types August 7, 2023 20:37
@colinrotherham colinrotherham force-pushed the nested-option-formatting branch 2 times, most recently from 87711bd to 244244d Compare August 7, 2023 20:54
@colinrotherham colinrotherham force-pushed the option-table-types branch 2 times, most recently from d6587ee to 9c05f9f Compare August 14, 2023 08:22
@colinrotherham colinrotherham force-pushed the nested-option-formatting branch from 244244d to 089195c Compare August 14, 2023 08:22
@colinrotherham colinrotherham force-pushed the nested-option-formatting branch from 089195c to 024f259 Compare August 15, 2023 15:21
@colinrotherham colinrotherham force-pushed the option-table-types branch 5 times, most recently from 04ca24e to d6559fe Compare August 29, 2023 16:56
@colinrotherham
Copy link
Contributor Author

I've given one this a rebase to fix the conflict

Spike wise, it sounded quite simple to always show parent names in code notation for:

  1. Nested object childparent.child
  2. Nested array childparent[].child

But this soon gets more complicated for deeply nested options

Footer showing deeply nested code notation Summary list showing deeply nested code notation

@stevenjmesser
Copy link
Contributor

@colinrotherham Please can you confirm whether this needs design or dev review?

@colinrotherham
Copy link
Contributor Author

colinrotherham commented Sep 25, 2023

@stevenjmesser Both please

Out of the series of Macro options spikes this was the most extreme, so no problem saying "let's close it"

@colinrotherham colinrotherham force-pushed the option-table-types branch 2 times, most recently from 112d29c to 552f606 Compare September 28, 2023 08:35
@colinrotherham colinrotherham force-pushed the nested-option-formatting branch from 096ec9f to 8d16ab8 Compare September 28, 2023 08:36
@colinrotherham colinrotherham force-pushed the nested-option-formatting branch from 8d16ab8 to 4becbde Compare September 28, 2023 08:57
@colinrotherham colinrotherham force-pushed the nested-option-formatting branch from 4becbde to 330b8e6 Compare September 28, 2023 09:03
Base automatically changed from option-table-types to main September 28, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design documentation User requests new documentation or improvements to existing documentation website Issues relating to the Design System website itself
Projects
Development

Successfully merging this pull request may close these issues.

3 participants