patternfly-elements icon indicating copy to clipboard operation
patternfly-elements copied to clipboard

pfe-disclosure

Open coreyvickery opened this issue 5 years ago • 11 comments

coreyvickery avatar Apr 16 '20 04:04 coreyvickery

Disclosure

Themes

There are two themes available to choose from.

Light theme

Disclosure, light theme

Dark theme

Disclosure, dark theme

Styles

Light theme, Collapsed

https://xd.adobe.com/spec/3e62e93c-8338-4f31-5040-3b81f0ed5c71-4853/screen/e5f80536-7da1-421e-813a-1cb974cfcd02/Disclosure-light-theme

Typography

  • Text label: Red Hat Text, Regular, 16pt / 24 (1.5), #151515

Color

  • Angle/caret icon: #151515
  • Border: #d2d2d2
  • Hover and Active/Pressed state panel backgrounds: #f0f0f0 Untitled-1a Untitled-1b

Light theme, Expanded

https://xd.adobe.com/spec/3e62e93c-8338-4f31-5040-3b81f0ed5c71-4853/screen/e5f80536-7da1-421e-813a-1cb974cfcd02/Disclosure-light-theme

Typography

  • Text label: Red Hat Text, Regular, 16pt / 24 (1.5), #151515

Color

  • Highlight bar: #e00
  • Highlight bar width: 3px
  • Shadow: #151515
  • Shadow opacity: 10%
  • Shadow distance: 3px
  • Shadow blur: 4px
  • Hover and Active/Pressed state panel backgrounds: #f0f0f0 Untitled 2a Untitled 2b

Dark theme, Collapsed

https://xd.adobe.com/spec/3e62e93c-8338-4f31-5040-3b81f0ed5c71-4853/screen/2fe14520-f086-4aca-ba9a-63a8118bbdd0/Disclosure-dark-theme

Typography

  • Text label: Red Hat Text, Regular, 16pt / 24 (1.5), #fff

Color

  • Angle/caret icon: #fff
  • Border: #6a6e73
  • Hover and Active/Pressed state panel backgrounds: #3c3f42 Disclosure, dark theme, hover Disclosure, dark theme, active-pressed

Dark theme, Expanded

https://xd.adobe.com/spec/3e62e93c-8338-4f31-5040-3b81f0ed5c71-4853/screen/2fe14520-f086-4aca-ba9a-63a8118bbdd0/Disclosure-dark-theme

Typography

  • Text label: Red Hat Text, Regular, 16pt / 24 (1.5), #fff

Color

  • Highlight bar: #e00
  • Highlight bar width: 3px
  • Shadow: N/A
  • Shadow opacity: N/A
  • Shadow distance: N/A
  • Shadow blur: N/A
  • Hover and Active/Pressed state panel backgrounds: #3c3f42 Disclosure, dark theme, expanded, hover Disclosure, dark theme, expanded, active-pressed

Interaction states

Light theme

Default Disclosure, light theme, default Disclosure, light theme, expanded, default

Focus

A focus indicator is added around the entire panel background. Disclosure, light theme, focus Disclosure, light theme, expanded, focus

Hover

Changes the panel background color to #f0f0f0. Untitled-1a Untitled 2a

Active/Pressed

A focus indicator is added around the entire panel background and the background color remains the same as the Hover state. Untitled-1b Untitled 2b

Dark theme, Collapsed

Default Disclosure, dark theme, default Disclosure, dark theme, expanded, default

Focus

A focus indicator is added around the entire panel background. Disclosure, dark theme, focus Disclosure, dark theme, expanded, focus

Hover

Changes the panel background color to #3c3f42. Disclosure, dark theme, hover Disclosure, dark theme, expanded, hover

Active/Pressed

A focus indicator is added around the entire panel background and the background color remains the same as the Hover state. Disclosure, dark theme, active-pressed Disclosure, dark theme, expanded, active-pressed


Breakpoints

Light theme

https://xd.adobe.com/spec/3e62e93c-8338-4f31-5040-3b81f0ed5c71-4853/screen/26f7f59a-7dbe-45b4-9e7d-8883fe22d4c2/Disclosure-light-theme-overflows

Desktop

If a text box is used, the max width is 750px in large breakpoints like Desktop and Tablet. Disclosure, light theme (desktop)

Tablet, landscape Disclosure, light theme (tablet, landscape)

Tablet, portrait Disclosure, light theme (tablet, portrait)

Mobile, landscape Disclosure, light theme (mobile, landscape)

Mobile, portrait

Text labels that are written longer will break to two lines in all breakpoints. Disclosure, light theme (mobile, portrait)

Dark theme

https://xd.adobe.com/spec/3e62e93c-8338-4f31-5040-3b81f0ed5c71-4853/screen/ecef1a5e-af9d-493b-9b74-20e5ee7e61c4/Disclosure-dark-theme-overflows

Desktop

If a text box is used, the max width is 750px in large breakpoints like Desktop and Tablet. Disclosure, dark theme (desktop)

Tablet, landscape Disclosure, dark theme (tablet, landscape)

Tablet, portrait Disclosure, dark theme (tablet, portrait)

Mobile, landscape Disclosure, dark theme (mobile, landscape)

Mobile, portrait

Text labels that are written longer will break to two lines in all breakpoints. Disclosure, dark theme (mobile, portrait)


Accessibility

If the Disclosure is collapsed:

Key Interaction
Tab Focuses the entire panel background
Enter or Space Expands the Disclosure

If the Disclosure is expanded:

Key Interaction
Tab Focuses the next interactive element in the tab order
Shift + Tab Focuses the previous interactive element in the tab order or the panel background
Enter or Space Activates the focused interactive element or collapses the Disclosure
Esc Collapses the Disclosure and then moves the focus to the panel background

Usage

Default state

  • Disclosures should always appear on screen as Collapsed when the page or the parent component loads

Placing Disclosures on backgrounds

Light backgrounds Disclosure, light theme, bad BGs

Guidelines

  • Use on white or light gray backgrounds only
  • Don't use on backgrounds that are the same color or darker than the border color
  • Switch themes if it's used on an opposing background color

Dark backgrounds Disclosure, dark theme, bad BGs

Guidelines

  • Use on black or dark gray backgrounds only
  • Don't use on backgrounds that are the same color or lighter than the border color
  • Switch themes if it's used on an opposing background color

Spacing

Light theme

Desktop Disclosure, desktop, light theme, spacing

Mobile Disclosure, mobile, light theme, spacing

Dark theme

Desktop Disclosure, desktop, dark theme, spacing

Mobile Disclosure, mobile, dark theme, spacing

Spacing legend https://www.patternfly.org/v4/design-guidelines/styles/spacers

coreyvickery avatar Apr 22 '20 05:04 coreyvickery

@starryeyez024 Since PatternFly doesn't have a Disclosure component, I was advised to change the name of our Disclosure component to pfe-expandable to map closer to their Expandable section component. I have already made this change in the design kit and I'm working on edits to ux.redhat.com. However, the styles will remain the same.

https://www.patternfly.org/v4/components/expandable-section/

coreyvickery avatar Mar 03 '21 04:03 coreyvickery

Hey @coreyvickery, thanks for relaying this. We may want to bring together a meeting of the minds before we change names of existing components, because of the complexities therein. As you know we already have and the disclosure styles are baked into that via an attribute. Since we want to avoid breaking changes until we are ready for a major 2.0 release (probably not til much later this year) we'll at least want to maintain support for this markup <pfe-accordion disclosure> .

That being said, we could explore the idea further of adding support for <pfe-expandable> or maybe an attribute called expandable on the accordion. Just for background context (if I remember correctly), we were trying to make it easier for developers to easily switch back and forth with as few markup adjustments as possible. For example, in the most basic version of the accordion (1 header, 1 panel) there are 6 instances where it says the name of the tag, so they'd have to change all of them from "accordion" to "expandable", vs. adding 1 attribute.

<pfe-accordion>
  <pfe-accordion-header>
  <h3>This is a disclosure</h3>
  </pfe-accordion-header>
  <pfe-accordion-panel>
  <p>Lorem ipsum dolo  a rebum.</p>
  <p>Stet clita kasd gubergren .</p>
  </pfe-accordion-panel>
</pfe-accordion>

There is also some handy logic baked-in, which makes this easier for developers not to have to do any guesswork. From the readme:

If pfe-accordion has one pfe-accordion-header, it will get tagged with disclosure="true". This applies a slightly different set of styles: chevron appears on the left side, the header has a single border on all four sides. Applying disclosure="false" to a pfe-accordion element containing only one header/panel pairing will set the element to display as a standard accordion.

We could easily add support for the attribute name expandable as an alias for disclosure, if that's the way we decide to go. I think we chose the wording "disclosure" because that had more meaning when it comes to semantics & accessibility.

  • https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details.
  • https://accessuse.eu/en/disclosure-widgets.html

Ok that's my brain dump! Happy to discuss more or have others chime in here.

starryeyez024 avatar Mar 03 '21 16:03 starryeyez024

Lots of +1 for Kendall's feedback above. I'll add, one workaround possible is to create a pfe-expandable component that is basically a wrapper for <pfe-accordion disclosure>. Both continue to work and styles continue to live in 1 place which is a better developer experience.

castastrophe avatar Mar 04 '21 21:03 castastrophe

@starryeyez024 @castastrophe Thank you both for that information, I don't think we need to change anything. I will alert the PatternFly team that we need to keep the name Disclosure for marketing use cases for all of the reasons outlined here.

coreyvickery avatar Mar 09 '21 20:03 coreyvickery

@castastrophe Are there other issues where the implementation for this is still being worked on or where can I see the latest web component?

coreyvickery avatar Mar 16 '21 17:03 coreyvickery

https://patternflyelements.com/elements/pfe-accordion/demo/

starryeyez024 avatar Mar 16 '21 17:03 starryeyez024

Some of the styles and spacing are still not correct.

coreyvickery avatar Mar 16 '21 17:03 coreyvickery

Reopening: TODO to clean up styles

castastrophe avatar Mar 24 '21 14:03 castastrophe

@coreyvickery can you confirm styles are now correct, and if so close this issue? https://patternflyelements.com/elements/pfe-accordion/demo/

starryeyez024 avatar Apr 01 '21 20:04 starryeyez024

@starryeyez024 Not quite, but close. If you scroll up, you can see what the correct interaction states should look like, we pulled some of them from what PatternFly is doing.

https://www.patternfly.org/v4/components/accordion

coreyvickery avatar Apr 07 '21 15:04 coreyvickery