Closed Bug 1809457 Opened 3 years ago Closed 3 years ago

in-content/common.css styles conflict with Storybook's input styles

Categories

(Toolkit :: UI Widgets, defect, P3)

defect

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: hjones, Assigned: hjones)

References

(Blocks 1 open bug)

Details

(Whiteboard: [recomp])

Attachments

(4 files)

We've been loading in-content/common.css in the Storybook preview-head.html file to make it available to all our stories, but the styles from that file are conflicting with Storybook's own styles for various inputs. This impacts the usability of Storybook's controls.

One option for a fix is to create a custom element/shadow DOM wrapper around our stories and only load our in-content CSS there so it doesn't interfere with Storybook's global styles.

The Bugbug bot thinks this bug should belong to the 'Toolkit::XUL Widgets' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → XUL Widgets
Product: Firefox → Toolkit

This fixes the style leakage/conflict issue @tgiles identified by using @mstriemer's WithCommonStyles component as a Storybook decorator.

Assignee: nobody → hjones
Status: NEW → ASSIGNED

When named-deck is used in the shadow DOM we need to add listeners, check for activeElement, and query for elements on the shadow root rather than document.

Similar to named-deck listeners and activeElement checks needed to be updated to use getRootNode for cases where panel-list is used in the shadow DOM. parentElement also doesn't account for shadow roots, but swapping out shadowRoot.host seems to work the same. I also pulled in the changes from https://phabricator.services.mozilla.com/D166376.

Depends on D166700

These addons either no longer work with our custom element wrapper, or never really worked:

  • backgrounds - isn't super useful because it doesn't follow theme and now doesn't have any visible effect
  • mesaure - this one breaks when you click on it, it seems to be looking for a specific root element
  • outline - this stil works on the docs page but isn't really useful on the main story page anymore
Pushed by hjones@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/628664fcb1a5 use getRootNode in named-deck so it works in shadow DOM r=mstriemer https://hg.mozilla.org/integration/autoland/rev/5eca10cd82c2 make panel-list work in shadow DOM r=mstriemer https://hg.mozilla.org/integration/autoland/rev/24528f1f21bd Add decorator/wrapper component to fix Storybook style conflicts r=mstriemer https://hg.mozilla.org/integration/autoland/rev/12ca538c258c 1809457, 1809457: apply code formatting via Lando
Pushed by hjones@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6ee128add6a9 disable wonky Storybook addons r=mstriemer
Whiteboard: [fidefe-reusable-components-ms1] → [fidefe-reusable-components-ms2]
Whiteboard: [fidefe-reusable-components-ms2] → [recomp]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: