Git Product home page Git Product logo

spectrum-css's Introduction

GitHub Actions build status on main
GitHub Actions build status on spectrum-two

Spectrum CSS

A CSS-implementation of the Spectrum design language

Features

  • ๐Ÿ“– Robust documentation: Spectrum CSS is designed to be used in partnership with Spectrum's detailed usage guidelines.
  • ๐ŸŽจ Flexible: Our CSS is customizable, powerful, and designed to work with any JavaScript framework.
  • ๐Ÿงช Rigorously tested: These individually-versioned components have been vetted to be accessible and inclusive of global audiences.
  • ๐Ÿ“ฑ Multi-platform support: We support evergreen browsers for scalability and flexibility.

ย ย ย ย  ย 

Using Spectrum CSS

The preferred method of using Spectrum CSS relies on custom properties to swap out variables for different themes and contexts. This results in the lowest bundle sizes and is one of the simpler approaches.

Want to get a component up and running as soon as possible? Check out the quick start guide.

Functionality

Spectrum CSS is CSS-only, implementing only the interactivity that can be done with pure CSS. We do include some lightweight JS-based interaction for demonstration purposes only in our Storybook. Spectrum CSS should only be used by implementations of Spectrum, or very simple applications that only need things like typography, checkboxes, text fields, etc.

Adobe maintains separate libraries written with web components and React that work in partnership with Spectrum CSS to create fully interactive Spectrum components.

The Spectrum Web Components library directly imports Spectrum CSS and optimizes it for use with web components.

Installing components

Each component is released on npm as a separate, individually versioned package inside of the @spectrum-css org.

To incorporate Spectrum CSS into your project, you install the components you need along with any peer dependencies you need for your implementation. Most peer dependencies are optional and can bring additional features when installed along with a component. For example a button can be rendered with or without an icon; so if your use-case leverages an icon with your button, you'll want to install icon as a peer dependency.

yarn add -DW @spectrum-css/tokens @spectrum-css/typography @spectrum-css/page @spectrum-css/icon @spectrum-css/button

Installed components will be available in the node_modules/@spectrum-css/ folder of your project.

All components in this library have a peer dependency on @spectrum-css/tokens, which is a local package that serves up the Spectrum design tokens as CSS custom properties (via Style dictionary). These custom properties are leveraged in all components to create a cohesive visual language and to allow for easy theming. If you choose not to use the provided @spectrum-css/tokens package, you must define your own custom properties or your components will render with a significant number of missing styles. When overriding certain styles is necessary, modifying styles is supported through the use of component-specific --mod prefixed properties. More on this below.

Using components in your project

Spectrum CSS components have build output that is designed to be used in a variety of ways:

  • index.css - Preferred and most commonly used to incorporate Spectrum CSS into a project. This file includes the component's styles and variable definitions. In this version, token-driven CSS properties1 are mapped to empty --mod prefixed variables (for customization) with a fallback to variables prefixed with --spectrum (sourced from the design tokens).

    • This file loads both the .spectrum and .spectrum--express contexts which are used to toggle components between two different visual styles. The .spectrum context is the default.
  • index-vars.css - Deprecated. This file is identical to index.css. It is provided as a fallback for older implementations that may have been using it and will be removed. It is recommended to use index.css instead.

  • index-base.css: This file mimics the index.css output, but does not include the .spectrum or .spectrum--express contexts.

    • If your product only requires the .spectrum context, you can use index-base.css plus themes/spectrum.css from the themes directory to render the default Spectrum visual language.
      • The .spectrum--express context, on the other hand, is dependent on/expands on the default .spectrum context. This means if you only want to use the Express context, you still need to include themes/spectrum.css. In this case, we recommend using index.css instead since it includes both contexts by default.
    • This approach can also be used when you have defined and written your own visual language and only need the base component styles from Spectrum CSS. To wire up your own visual language, you would need to define your own custom properties that match those defined in the themes/*.css assets.
  • index-theme.css: This file provides only the visual language for a component. It is used in conjunction with index-base.css and when loaded together, provides the same result as using index.css by itself.

1: Token-driven CSS properties are properties whose values are mapped to a value in the @spectrum-css/tokens package. These values represent design-language and are meant to be used across platforms. In contrast, properties specific to web-based implementations will not have a token value assigned, so not all CSS properties will use custom properties.

Including assets

Start by including the base set of variables:

/* Include tokens */
@import "node_modules/@spectrum-css/tokens/dist/index.css";

/*
  For components with no other contexts available, load the
  index.css file from the component's package. These are components
  that do not have a spectrum or express context available.
*/
@import "node_modules/@spectrum-css/page/dist/index.css";
@import "node_modules/@spectrum-css/typography/dist/index.css";
@import "node_modules/@spectrum-css/icon/dist/index.css";

/*
  Recommended: For components with multiple contexts available, if you
  want access to all contexts, load the index.css file, which includes
  all contexts and component variables.
*/
@import "node_modules/@spectrum-css/button/dist/index.css";

/*
  If you only need the spectrum visual context: For components with
  multiple contexts available, load only the spectrum context by sourcing
  index-base.css and the spectrum theme from the themes directory.
*/
@import "node_modules/@spectrum-css/button/dist/index-base.css";
@import "node_modules/@spectrum-css/button/dist/themes/spectrum.css";

Tokens values are mapped to context-specific classes which can be applied to the <html> element or any place in your DOM where you wish to encapsulate or alter the visual language of your Spectrum components.

All contexts you want to use must be defined in order to load all the appropriate custom properties for the components you are using.

Global variables

Visual language
  • .spectrum - The default visual language for Spectrum CSS
  • .spectrum--express - A variant of the standard visual language. This visual language will be deprecated in Spectrum 2.
Scales

Scales represent the browsing context of the user. They are used to adjust the size of components to improve readability and usability on different devices.

  • .spectrum--medium - The default scale for Spectrum CSS, used for desktop and tablet devices
  • .spectrum--large - A larger scale for Spectrum CSS, used for mobile devices and other small screens to create a more touch-friendly experience
Themes (colorstops)

Themes represent the color scheme of the user's browsing context. They are used to adjust the color of components to improve readability and usability in different environments.

  • .spectrum--light - The default theme for Spectrum CSS, used for light mode
  • .spectrum--dark - A darker theme for Spectrum CSS, used for dark mode

Other themes are available but are in the process of being deprecated and should not be used in new projects.

Context example

Put together, we would define the context for our application in the following way:

<html class="spectrum spectrum--medium spectrum--light"></html>

To switch to Express, add the .spectrum--express class to the <html> element:

<html class="spectrum spectrum--medium spectrum--light spectrum--express"></html>

Note the spectrum--express class is added to the existing classes; spectrum should always be present to ensure the correct visual language is loaded.

Because CSS custom properties honor the cascading nature of CSS, you can infinitely nest different contexts. For example, you could have a .spectrum--dark context inside of a .spectrum--light context, and components will honor the innermost context.

Modifying components

You can override variables and modify Spectrum CSS' look and feel by re-defining the custom properties in context. Look for the Custom Property API section in each component to determine which custom properties you can override. See Action Button for a complete example.

Importing UI icons

Some components require certain "UI icons" to render. These icons are released within the @spectrum-css/ui-icons package and are used by components like @spectrum-css/icon and @spectrum-css/actionbutton.

Based on which scales you'll be using, you can choose to load different files:

  • spectrum-css-icons.svg - Both medium and large icons for responsive UIs that support both .spectrum--medium and .spectrum--large

  • spectrum-css-icons-medium.svg - Medium icons only, supports .spectrum--medium only

  • spectrum-css-icons-large.svg - Large icons only, supports .spectrum--large only

Note: If you're using spectrum-css-icons.svg, be sure to add .spectrum--medium or .spectrum--large to the <html> element, or you'll see both medium and large icons at once.

Importing workflow icons

If your app has any level of complexity, you'll need "workflow" icons to indicate actions. These icons are not required to render the base components, and instead are used within buttons or menu items for actions like share, play, justify, save, etc.

These icons are released within the @adobe/spectrum-css-workflow-icons package. Visit the Spectrum workflow icon list and click on any icon to get the SVG markup.

Language support

To take advantage of locale specific changes such as placeholders not italicizing Japanese, your application should specify a Content-Language response header or set the lang attribute.

In addition, you should set the dir attribute for components to render correctly.

For English, a left-to-right language:

<html lang="en" dir="ltr"></html>

For Arabic, a right-to-left language:

<html lang="ar" dir="rtl"></html>

Browser support

We maintain a modern codebase that supports the latest two versions of evergreen web browsers. The current list of browsers officially supported by Spectrum CSS can be found in the browserslist section of the project's package.json file. This setting is used by the build tools when the source files are built. If you require additional browser support for your project, the CSS can be processed further with your chosen tools.

  • latest 2 Edge versions
  • latest 2 Chrome versions
  • latest 2 Firefox versions
  • latest 2 Safari versions
  • latest 2 iOS versions

Optimizing Spectrum CSS

Spectrum CSS is designed to be as modern and flexible as possible, and as such, leaves room for consumers to optimize in their own way. There are many tools and techniques you can use to optimize CSS for your project such as tree shaking, purging, and minification. If you are loading the entire set of @spectrum-css/tokens for example, you can safely tree shake the tokens to only include the variables you are using, often leading to a significant reduction in file size.

Contributing

A very special thank you to all of our contributors without whom this project would not be possible.

Want to join the team? Check out the contributing guidelines to get started.

Tasks

The following tasks are available:

Command Description Examples
clean Cleans all output files for the project and all components yarn clean
build Performs a build of all components yarn build
build:all Performs a build of all components, documentation site, and storybook yarn build:all
dev Performs a component build and serves the documentation on the default port (3000) yarn dev
compare This compares the current version of components with the previous versions published to NPM and output a list of all the changes that have been made. This is useful for reviewing changes before a release. The information is provided in the command-line output as well as in a simple web page that is opened in your default browser upon completion. The web page includes links to the visual diffs for each component when the file sizes have changed.
  • Components with no changes are not included in the output.
  • To run comparisons on one or multiple components, compare accepts a list of components as arguments. For example, yarn compare button will compare the current version of the button component with the previous version published to NPM. yarn compare button checkbox will compare the current version of the button and checkbox components with the previous versions published to NPM.
  • Named components should be space-separated.
  • Running compare with no inputs will automatically run against all packages.
yarn compare
yarn compare accordion
yarn compare accordion actionbutton
lint Provides helpful updates and warnings for a component's package.json file. This helps keep all components in alignment. Use format to automatically fix any issues that are found. To run on a single component, use yarn linter accordion (where accordion is the name of the component or components you want to lint). yarn lint
yarn linter accordion
yarn linter accordion actionbutton
format Provides helpful updates and warnings for a component's package.json file. This helps keep all components in alignment. To run on a single component, use yarn formatter accordion (where accordion is the name of the component or components you want to lint). yarn format
yarn formatter accordion
yarn formatter accordion actionbutton
refresh:env This copies values for the project's .env file (an asset never committed to the repo as it contains login secrets) by using the .env.example file as a template. This script is useful when you need to update the .env file with new values from the .env.example file or when you checkout or clean the repo and need to restore the .env file. yarn refresh:env

Troubleshooting

As of February of 2024, the Spectrum CSS project has moved to a new tokens system (@spectrum-css/tokens instead of @spectrum-css/vars). If you are using Spectrum CSS and see that your styles are off, or not applying at all, ensure that you are using the correct tokens package for the component.

spectrum-css's People

Contributors

arminrosu avatar bernhard-adobe avatar castastrophe avatar dependabot[bot] avatar devongovett avatar filmaj avatar garthdb avatar github-actions[bot] avatar jawinn avatar jenndiaz avatar jianliao avatar jnurthen avatar karstens avatar lazd avatar lunarfusion avatar majornista avatar martskin avatar mdt2 avatar misterbrownlee avatar mlogsdon18 avatar mrcjhicks avatar natebaldwindesign avatar pfulton avatar rajarju avatar snowystinger avatar stevengill avatar timkim avatar venkateshjo avatar westbrook avatar xitter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spectrum-css's Issues

Remove redirect

Expected Behavior

Just load the page.

Actual Behavior

Right now, http://opensource.adobe.com/spectrum-css/ redirects to the latest version in a separate directory.

Potential solution

Generate the current version in the base directory and in the versioned directory.

Icons broken due to missing 'spectrum-icons.svg'

Expected Behavior

Icons show up in the proper html when the loadIcons() function is called, passing as the parameter the path of e.g. the 'spectrum-css-icons.svg' or 'spectrum-css-icons-medium.svg' (as suggested in the doc)

Actual Behavior

They don't. Actually, running Gulp in the current repo produces a dist/docs page where the icons are missing too. As a side note, the readme mentions AdobeSpectrum.loadIcons(), while the currently provided function is just loadIcons()

Reproduce Scenario (including but not limited to)

Run Gulp and open dist/docs โ€“ the only icon that works (e.g. in the Action Button) is the one where the svg is passed literaly.

Spectrum-CSS version

2.7.2

Sample Code that illustrates the problem

<button class="spectrum-ActionButton">
    <svg class="spectrum-Icon spectrum-Icon--sizeS spectrum--medium" focusable="false" aria-hidden="true"
        aria-label="Edit">
        <use xlink:href="#spectrum-icon-18-Edit"></use>
    </svg>
    <span class="spectrum-ActionButton-label">Edit</span>
</button>

Workaround

Inspecting the way the online doc page works (as opposed to the repo's gulp generated doc), the file that is passed to loadIcons() is 'spectrum-icons.svg', and not 'spectrum-css-icons.svg'. Problem is that such file is not found anywhere in the repository.

Dowloading it from the online page and using it locally, icons finally do display!

Thanks,

Davide

Accordion: Update implementation to follow WAI-ARIA 1.1 design pattern

Expected Behavior

The WAI-ARIA design pattern for Accordion has changed from WAI-ARIA 1.0 to WAI-ARIA 1.1.

WAI-ARIA 1.0 implemented Accordion using role="tablist", which, in addition to being somewhat confusing to a keyboard user, was problematic for users of the JAWS screen reader. Basically, using role="tablist" on the Accordion switches JAWS into forms mode when an Accordion item header receives focus. In forms mode, content within the expanded panels cannot be accessed using the screen reader. One can exit forms mode to access panel content by pressing the Esc key, but if the Accordion happens to be a descendant of a Dialog, the Esc key will also close the Dialog. There doesn't seem to be a good workaround for this other than switching to the WAI-ARIA 1.1 design pattern that doesn't use role="tablist".

In WAI-ARIA 1.1, each Accordion header is presented as a button element wrapped in a header, h3 element. JAWS won't shift into forms mode when an item header receives focus and the panel content will be easier to access.

See: https://w3c.github.io/aria-practices/#accordion for more detail.

Spectrum-CSS version

2.7.2

Sample Code that illustrates the problem

WAI-ARIA 1.0 Implementation:

<div class="spectrum-Accordion" role="tablist" aria-multiselectable="true">
  <div class="spectrum-Accordion-item is-open" role="presentation">
    <div class="spectrum-Accordion-itemHeader" tabindex="0" role="tab" aria-selected="true" aria-expanded="true" aria-controls="spectrum-accordion-item-0-content" id="spectrum-accordion-item-0-header">Header 1</div>
    <svg class="spectrum-Icon spectrum-UIIcon-ChevronRightMedium spectrum-Accordion-itemIndicator" focusable="false" aria-hidden="true">
      <use xlink:href="#spectrum-css-icon-ChevronRightMedium" />
    </svg>
    <div class="spectrum-Accordion-itemContent" role="tabpanel" id="spectrum-accordion-item-0-content" aria-labelledby="spectrum-accordion-item-0-header">Item 1</div>
  </div>
  <div class="spectrum-Accordion-item is-disabled" role="presentation">
    <div class="spectrum-Accordion-itemHeader" role="tab" aria-selected="false" aria-expanded="false" aria-disabled="true"  aria-controls="spectrum-accordion-item-1-content" id="spectrum-accordion-item-2-header">Header 2</div>
    <svg class="spectrum-Icon spectrum-UIIcon-ChevronRightMedium spectrum-Accordion-itemIndicator" focusable="false" aria-hidden="true">
      <use xlink:href="#spectrum-css-icon-ChevronRightMedium" />
    </svg>
    <div class="spectrum-Accordion-itemContent" role="tabpanel" id="spectrum-accordion-item-1-content" aria-labelledby="spectrum-accordion-item-2-header">Item 2</div>
  </div>
  <div class="spectrum-Accordion-item" role="presentation">
    <div class="spectrum-Accordion-itemHeader" tabindex="0" role="tab" aria-selected="false" aria-expanded="false aria-controls="spectrum-accordion-item-2-content" id="spectrum-accordion-item-2-header"">Header 3</div>
    <svg class="spectrum-Icon spectrum-UIIcon-ChevronRightMedium spectrum-Accordion-itemIndicator" focusable="false" aria-hidden="true">
      <use xlink:href="#spectrum-css-icon-ChevronRightMedium" />
    </svg>
    <div class="spectrum-Accordion-itemContent" role="tabpanel" id="spectrum-accordion-item-2-content" aria-labelledby="spectrum-accordion-item-2-header">Item 3</div>
  </div>
  <div class="spectrum-Accordion-item" role="presentation">
    <div class="spectrum-Accordion-itemHeader" tabindex="0" role="tab" aria-selected="false" aria-expanded="false" aria-controls="spectrum-accordion-item-3-content" id="spectrum-accordion-item-3-header">Header 4</div>
    <svg class="spectrum-Icon spectrum-UIIcon-ChevronRightMedium spectrum-Accordion-itemIndicator" focusable="false" aria-hidden="true">
      <use xlink:href="#spectrum-css-icon-ChevronRightMedium" />
    </svg>
    <div class="spectrum-Accordion-itemContent" role="tabpanel" id="spectrum-accordion-item-3-content" aria-labelledby="spectrum-accordion-item-3-header">Item 4</div>
  </div>
</div>

WAI-ARIA 1.1 Implementation

  <div class="spectrum-Accordion" role="region">
    <div class="spectrum-Accordion-item is-open" role="presentation">
      <h3 class="spectrum-Accordion-itemHeading">
        <button class="spectrum-Accordion-itemHeader" type="button" id="spectrum-accordion-item-0-header" aria-controls="spectrum-accordion-item-0-content" aria-expanded="true">Header 1</button>
        <svg class="spectrum-Icon spectrum-UIIcon-ChevronRightMedium spectrum-Accordion-itemIndicator" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-ChevronRightMedium" />
        </svg>
      </h3>
      <div class="spectrum-Accordion-itemContent" role="region" id="spectrum-accordion-item-0-content" aria-labelledby="spectrum-accordion-item-0-header">Item 1</div>
    </div>
    <div class="spectrum-Accordion-item is-disabled" role="presentation">
      <h3 class="spectrum-Accordion-itemHeading">
        <button class="spectrum-Accordion-itemHeader" type="button" disabled id="spectrum-accordion-item-1-header" aria-controls="spectrum-accordion-item-1-content" aria-expanded="false">Header 2</button>
        <svg class="spectrum-Icon spectrum-UIIcon-ChevronRightMedium spectrum-Accordion-itemIndicator" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-ChevronRightMedium" />
        </svg>
      </h3>
      <div class="spectrum-Accordion-itemContent" role="region" id="spectrum-accordion-item-1-content" aria-labelledby="spectrum-accordion-item-1-header">Item 2</div>
    </div>
    <div class="spectrum-Accordion-item" role="presentation">
      <h3 class="spectrum-Accordion-itemHeading">
        <button class="spectrum-Accordion-itemHeader" type="button" id="spectrum-accordion-item-2-header" aria-controls="spectrum-accordion-item-2-content" aria-expanded="false">Header 3</button>
        <svg class="spectrum-Icon spectrum-UIIcon-ChevronRightMedium spectrum-Accordion-itemIndicator" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-ChevronRightMedium" />
        </svg>
      </h3>
      <div class="spectrum-Accordion-itemContent" role="region" id="spectrum-accordion-item-2-content" aria-labelledby="spectrum-accordion-item-2-header">Item 3</div>
    </div>
    <div class="spectrum-Accordion-item" role="presentation">
      <h3 class="spectrum-Accordion-itemHeading">
        <button class="spectrum-Accordion-itemHeader" type="button" id="spectrum-accordion-item-3-header" aria-controls="spectrum-accordion-item-3-content" aria-expanded="false">Header 4</button>
        <svg class="spectrum-Icon spectrum-UIIcon-ChevronRightMedium spectrum-Accordion-itemIndicator" focusable="false" aria-hidden="true">
          <use xlink:href="#spectrum-css-icon-ChevronRightMedium" />
        </svg>
      </h3>
      <div class="spectrum-Accordion-itemContent" role="region" id="spectrum-accordion-item-3-content" aria-labelledby="spectrum-accordion-item-3-header">Item 4</div>
    </div>
  </div>

CSS box-sizing reset with high specificity breaks spectrum-Calendar-tableCell

spectrum-Calendar-tableCell has the following CSS:

.spectrum-Calendar-tableCell {
  text-align: center;
  padding: 0;
  position: relative;
  box-sizing: content-box;
  height: 32px;
  width: 32px;
  padding: 4px;
}

I always have the following CSS in my application:

.royale * {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
}

This has a higher specificity and overrides the first css. If the above is not allowed with spectrum-css, I could write my own overrides, but I think specifying global border-box sizing is pretty standard.

Changing the css to the following should fix it:

.spectrum .spectrum-Calendar-tableCell {
  text-align: center;
  padding: 0;
  position: relative;
  box-sizing: content-box;
  height: 32px;
  width: 32px;
  padding: 4px;
}

I'm wondering why content-box is being used at all though. Why not set the width and height to 40px and keep border-box sizing? That seems to work fine.

Circle Loader distorts on Win10 Mozilla, macOS Firefox 62.0.2.

Expected Behavior

Circle loader should spin smoothly as it does in Chrome.

Actual Behavior

Circle loader is distorted on Mozilla.

Steps to Reproduce

Open circle loader.

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Mozilla, Windows 10

CSS-only dropdown doesn't display correct when focused

Expected Behavior

CSS-only dropdown used in scale/color switcher in docs has a nice 2px thick border and background when focused.

Actual Behavior

It ends up with a 1px thick border, shifts in size, and has no background.

Steps to Reproduce

  1. Use the scale/color switcher in docs
  2. Observe ugly dropdown

Spectrum-CSS version

2.7.0

Screenshots (if applicable)

After selecting an option:
image

When focused:
image

Move visual regression testing to be out in the open

The visual regression tool still currently lives in the corporate side of this repo. Now that we are all open source, we can move to using a CI that offers free services to open source projects. I'm thinking Travis CI or Circle CI.

I have more experience with Circle CI but I think I may explore using Travis.

CSS output for typography contains stray &

Expected Behavior

Shouldn't have a stray &, break everything.

Actual Behavior

Has a stray &, breaks everything.

Steps to Reproduce

  1. Build project
  2. Look at dist/components/typography/index.css
  3. See this:
&.spectrum,
&.spectrum-Body,
.spectrum,
.spectrum-Body {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  font-style: normal;
}
  1. Cry

Spectrum-CSS version

2.6.0

Replace auto-updating-hash on docs site with anchor links

This suggestion came out of the performance investigation on the docs site in #6.

It's still unclear what perf impact the updating hash functionality has, but regardless of that, @ericdrobinson brought up a good point in #6 that updating the hash as you scroll through the page 100% messes up browsing history. As soon as you scroll on the docs site, the back button stops working.

@ericdrobinson's suggestion was to replace that functionality with anchor links that are copyable - like how headings in READMEs on GitHub are linked, can be copied, and render a little anchor icon to give users a hint that you may want to link/share to this. I like that suggestion.

Create release scripts for npm and artifactory releases

Need to document and automate the release process for both public and private

@lazd's current steps are

npm install @spectrum/[email protected] @spectrum/[email protected]
git checkout package.json package-lock.json
npm run release # publishes to Artifactory as @adobe/spectrum-css, even though we don't really want to do that, but also creates tags and stuff
# edit package.json to change @adobe to @spectrum
# publish to artifactory as @spectrum/spectrum-css
npm publish --registry=https://artifactory.corp.adobe.com:443/artifactory/api/npm/npm-spectrum-release-local
# now we're ready to publish to public
npm publish

Safari 10: Deletable Spectrum tag renders its closing "X" incorrectly

The deletable Spectrum tag renders its closing "X" incorrectly in older versions of Safari. This is due to the lack of support for justify-content (https://caniuse.com/#search=justify-content) in Safari 10 and older.

Expected Behavior

"X" in a deletable Spectrum tag should be center-aligned in the space available:
image

Actual Behavior

"X" in a deletable Spectrum tag is left aligned within the space available:
image

Reproduce Scenario (including but not limited to)

Viewing http://opensource.adobe.com/spectrum-css/2.7.2/docs/#tags---deletable in Safari 10.0, available in MacOS 10.12.

Steps to Reproduce

  1. Log into a MacOS 10.12 machine with Safari 10.0
  2. Open Safari 10.0 to http://opensource.adobe.com/spectrum-css/2.7.2/docs/#tags---deletable
  3. View the deletable tag rendering

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Safari 10.0 on MacOS 10.12

Spectrum-CSS version

spectrum-css 2.7.2

Sample Code that illustrates the problem

From the example at http://opensource.adobe.com/spectrum-css/2.7.2/docs/#tags---deletable:

<div class="spectrum-Tags" role="list" aria-label="Tags">
  <div class="spectrum-Tags-item spectrum-Tags-item--deletable" tabindex="0" role="listitem">
    <span class="spectrum-Tags-itemLabel">Tag 1</span>
    <button class="spectrum-ClearButton spectrum-ClearButton--small" aria-label="Remove tag 1" tabindex="-1">
      <svg class="spectrum-Icon spectrum-UIIcon-CrossSmall" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-css-icon-CrossSmall"></use>
      </svg>
    </button>
  </div>
  <div class="spectrum-Tags-item spectrum-Tags-item--deletable is-invalid" tabindex="0" role="listitem">
    <span class="spectrum-Tags-itemLabel">Tag 2</span>
    <button class="spectrum-ClearButton spectrum-ClearButton--small" aria-label="Remove tag 2" tabindex="-1">
      <svg class="spectrum-Icon spectrum-UIIcon-CrossSmall" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-css-icon-CrossSmall"></use>
      </svg>
    </button>
  </div>
  <div class="spectrum-Tags-item spectrum-Tags-item--deletable is-disabled" role="listitem">
    <span class="spectrum-Tags-itemLabel">Tag 2</span>
    <button class="spectrum-ClearButton spectrum-ClearButton--small" aria-label="Remove tag 3" tabindex="-1" disabled="">
      <svg class="spectrum-Icon spectrum-UIIcon-CrossSmall" focusable="false" aria-hidden="true">
        <use xlink:href="#spectrum-css-icon-CrossSmall"></use>
      </svg>
    </button>
  </div>
</div>```

#### Screenshots (if applicable)
See above.

Add sass compiling validation phrase while building the library

Expected Behavior

To avoid the problem like #61, we can introduce a sass compiling phrase while building the library. I've used this solution to catch a few invalid CSS file issues for angular-spectrum component library.

The solution is pretty simple:

  1. Add gulp-sass as dev dependency
  2. Create task and attach to the end phrase of build task. We don't need to keep the generated files, if sass compiling passed, we remove the generated files.

I would like to provide a PR if you agree.

Actual Behavior

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Spectrum-CSS version

Latest version and all the future versions.

Sample Code that illustrates the problem

Screenshots (if applicable)

Side Nav: Icon Variant

Expected Behavior

Need to include variant that allows for icons on parent-level navigation menu items

https://www.dropbox.com/s/kfbosnwyeg7eg5p/Side-Navigation_DNA.xd?dl=0

Actual Behavior

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Spectrum-CSS version

Sample Code that illustrates the problem

Screenshots (if applicable)

Documentation site takes 10-15 seconds to load

Expected Behavior

Loading the documentation site should be instant.

Actual Behavior

When loading the documentation site, it takes a good 10-15 seconds on the latest macOS Mojave and Safari via Gigabit internet.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Load normally http://opensource.adobe.com/spectrum-css/

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

MacOS 10.14.1
Safari 12.0.1

screen shot 2018-11-16 at 3 16 38 pm

Interaction is slow on mobile

Expected Behavior

Hover and down/up interactions should be fast and snappy.

Actual Behavior

When tapping buttons or any element which causes a visual update the change is very laggy. I'm seeing approximately 700ms delay in 'down' state interactions.

Reproduce Scenario (including but not limited to)

Browse the site on a pixel 2 or similar mobile devices.

Steps to Reproduce

Tap on a button and observe the delay in the down / up state transitions.

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Chrome, Android 9. Pixel 2.

Spectrum-CSS version

Current.

Header of Accordion component relies on user agent style to work

Expected Behavior

Hover state of spectrum-Accordion-itemHeader should not rely on user agent style for div to work. Because if I want to use it on a custom element or use it with customized normalize css, it will not work properly.

image

Actual Behavior

Hover state of spectrum-Accordion-itemHeader reply on below user agent style to work.
div { display: block; }

screen shot 2019-01-23 at 4 57 32 pm

Reproduce Scenario (including but not limited to)

Use spectrum-css with angular component.

Steps to Reproduce

Suppose I have a component template as below:

<ac-accordion class="spectrum-Accordion">
    <ac-accordion-item class="spectrum-Accordion-item">
        <ac-accordion-item-header class="spectrum-Accordion-itemHeader">Header 1</ac-accordion-item-header>
    </ac-accordion-item>
    <ac-accordion-item class="spectrum-Accordion-item">
        <ac-accordion-item-header class="spectrum-Accordion-itemHeader">Header 2</ac-accordion-item-header>
    </ac-accordion-item>
</ac-accordion>

Since class spectrum-Accordion-itemHeader is on a custom element, not on div. The hover state would not work.

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Latest Chrome Beta

Spectrum-CSS version

2.7.2

Sample Code that illustrates the problem

Screenshots (if applicable)

Base-level rules cannot contain the parent-selector-referencing character '&'

Expected Behavior

Base-level rules cannot contain the parent-selector-referencing character '&'

Actual Behavior

Contain & in dist/standalone/spectrum-dark.css etc. I believe it is a regression of #34.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Spectrum-CSS version

Master and 2.7.2

Sample Code that illustrates the problem

Screenshots (if applicable)

Docs site is requesting certificate on mobile for git.corp.adobe.com

Expected Behavior

Should be able to navigate to the site without issue and definitely without needing internal corporate certificates.

Actual Behavior

I get prompted to install the corporate cert:

screenshot_20181117-103201

Reproduce Scenario (including but not limited to)

Any mobile without the corp certificate.

Steps to Reproduce

Navigate to docs site on a mobile without the Adobe corp certificate installed.

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Chrome, Android.

Gulp fails at 'build-docs:topdoc'

Hi,
I've downloaded the repo and tried to build it: while npm install goes fine, gulp fails after several success steps at 'build-docs:topdoc', with error:

[16:21:53] 'build-docs:topdoc' errored after 15 ms
[16:21:53] Error: Command failed: /Users/davidebarranca/Dropbox/Developer/PROJECTS/ADOBE SPECTRUM/node_modules/.bin/topdoc
/bin/sh: /Users/davidebarranca/Dropbox/Developer/PROJECTS/ADOBE: No such file or directory

I've checked: topdoc is listed among the DevDependencies, and while a node_modules/topdoc folder has been successfully installed, .bin lacks a topdoc executable.

Node v10.13.0, npm 6.5.0, on macOS 10.14.1 here, if this may help. Thanks!

Circle Loader Breaks Using dir="rtl"

Expected Behavior

Loader doesn't break under dir="rtl"

Actual Behavior

Animation/layout of Circle Loader is broken

Reproduce Scenario (including but not limited to)

Add dir="rtl" to any ancestor of Circle Loader

Steps to Reproduce

Add dir="rtl" to any ancestor of Circle Loader

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Chrome 70

Spectrum-CSS version

Current

Sample Code that illustrates the problem

N/A

Screenshots (if applicable)

rtl

Add landing page to website

Let's look at adding a landing page to the website. We should also add some getting started documentation

Inconsistent Performance on CSS Demo/Documentation Page in Chrome/Safari

Expected Behavior

Scrolling through demos/documentation should be buttery smooth.

Actual Behavior

Scrolling is jerky in some browsers, making for a poor experience.

Reproduce Scenario (including but not limited to)

Visit the documentation with Safari or Chrome and quickly scroll through the content.

Steps to Reproduce

  1. Open the documentation using Chrome or Safari.
  2. Navigate to the demo/documentation page.
  3. Scroll the page at high speed.

* Firefox 63 does not exhibit this issue, though its Performance developer tools may provide further insights when investigating.

Browser name/version/os

  • Chrome Version 70.0.3538.110 (Official Build) (64-bit)
  • Safari Version 12.0.1 (14606.2.104.1.1)

Both tested on macOS 10.14.1.

Spectrum-CSS version

2.7.0

Sample Code that illustrates the problem

N/A

Screenshots (if applicable)

Firefox Developer Tools performance report:
image
Firefox almost is able to maintain a constant 60fps.

Chrome Developer Tools performance report:
image
It is hard to see in this screenshot but Chrome seems to hit an average of ~20-30fps.

Safari Web Inspector performance report:
image
While the majority of frames are able to be processed at 60fps or greater speed, there are a significant number of frames that do not hit that mark and cause the experience to feel jerky.

Broken ComboBox and z-index observations

In implementing spectrum css in a component set I noticed some things:

  1. Popover does not set a z-index.
    This has been a problem for me in at least 2 cases. One is ComboBox. The example http://opensource.adobe.com/spectrum-css/2.7.2/docs/#combo-box has <div class="dummy-spacing"></div> below the open combobox. Removing that div (which would not be there in a real application) causes the Popover to appear below the elements lower down.
  2. Similarly, we're implementing a calendar popup on DatePicker which has the same issue.

Setting a z-index of at least 1 on the Popover resolves these issues.

I looked through the CSS to see where z-index is being set. It looks like the highest level that's normally set is 2 unless an element is active in which case sometimes it's 3.

I'm not sure whether a z-index of 1 or 2 makes sense for Popover and what kind of weird interactions that might cause with other elements which have their z-index set.

I also noticed that spectrum-Steplist-markerContainer has a z-index of 2 and I don't see any effect of that setting. I'm wondering if it's necessary.

Migrate release notes

Release notes for the older versions should be migrated from internal Adobe github.

Update contributor.md by adding CLA info.

CLA info is missing in contirbutor.md. We should also discuss what type of contributions this project is comfortable taking. We should document that in the Contributing.md

Overflow Tabs

Expected Behavior

When there are too many tabs to fit horizontally across the viewport, the tabs component can be displayed as a quiet dropdown.

(Known to be examples only, not functional)

Actual Behavior

Old design spec implemented where the remaining tab items are hidden under a dropdown menu in an action button.

(Known to be examples only, not functional)

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Spectrum-CSS version

Sample Code that illustrates the problem

Screenshots (if applicable)

Current CSS implementation:
image

Updated design guideline:
image

Safari 10: Spectrum Button with few characters is misaligned

The Spectrum Button renders its contained span text off-center (to the left) when the text is shorter than the button's min-width attribute.

Expected Behavior

Button text will be center-aligned regardless of the content length.
image

Actual Behavior

Button text is left-aligned when the text is short.
image

Reproduce Scenario (including but not limited to)

Viewing a Spectrum button in Safari 10.0, available in MacOS 10.12.

Steps to Reproduce

  1. Log into a MacOS 10.12 machine with Safari 10.0
  2. Open Safari 10.0 to http://opensource.adobe.com/spectrum-css/2.7.2/docs/#button---cta
  3. Using the "Inspect Element" and/or Developer Panel, alter the button's contained span to display a short string, such as "Test"
  4. View the button text rendering

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Safari 10.0 on MacOS 10.12

Spectrum-CSS version

spectrum-css 2.7.2

Sample Code that illustrates the problem

From the modified example at http://opensource.adobe.com/spectrum-css/2.7.2/docs/#button---cta:

<button class="spectrum-Button spectrum-Button--cta">
  <span class="spectrum-Button-label">Test</span>
</button>

Screenshots (if applicable)

See above.

Checkbox tick is not displayed in Chrome when a parent container has a column-count or column-width property.

Expected Behavior

Checkbox tick should be visible for a checked checkbox.

Actual Behavior

Checkbox tick is not visible in Chrome for a checked checkbox.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

If you have a div that has a column-count or column-width style property, the tick of checked checkboxes from inside the div will not be visible. I noticed this issue in Chrome.

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Chrome Version 70.0.3538.110 (Official Build) (64-bit) MacOS

Spectrum-CSS version

2.6.0

Sample Code that illustrates the problem

<div class="cssdocs-example-demo" style="column-width: 200px; column-count: 2;">
   <label class="spectrum-Checkbox">
      <input type="checkbox" class="spectrum-Checkbox-input" id="checkbox-0">
      <span class="spectrum-Checkbox-box">
         <svg class="spectrum-Icon spectrum-UIIcon-CheckmarkSmall spectrum-Checkbox-checkmark" focusable="false" aria-hidden="true">
            <use xlink:href="#spectrum-css-icon-CheckmarkSmall"></use>
         </svg>
         <svg class="spectrum-Icon spectrum-UIIcon-DashSmall spectrum-Checkbox-partialCheckmark" focusable="false" aria-hidden="true">
            <use xlink:href="#spectrum-css-icon-DashSmall"></use>
         </svg>
      </span>
      <span class="spectrum-Checkbox-label">Checkbox</span>
   </label>
</div>

Screenshots (if applicable)

image

For fixing this issue we added in our project a CSS rule like this:

.checkboxList svg {
  -webkit-backface-visibility: hidden;
}

The .checkboxList rule was containing the column-count and column-with properties.

Release on npm

Need to release the latest version to npm under @adobe/spectrum-css name.

Livereload for documentation CSS and JS is broken

Expected Behavior

Docs page reloads when docs JS is changed, CSS is injected with docs CSS is changed.

Actual Behavior

It does the nothing

Steps to Reproduce

  1. gulp dev
  2. Change topdoc/resources/css/docs.css or topdoc/resources/js/docs.js
  3. Observe the nothing which happens

Spectrum-CSS version

2.6.0

gh-pages redirects don't generate

Expected Behavior

gh-pages redirects should generate for both icons and index

Actual Behavior

The paths are wrong, so nothing is generated

Steps to Reproduce

  1. gulp gh-pages
  2. Have no redirects, be sad

Spectrum-CSS version

2.6.0

[regression] Toast layout problems on IE11

Expected Behavior

IE11 layout should look like other browsers

Actual Behavior

see screenshot. There is overlap between text, the vertical bar and the close icon, and the width of the component is too narrow.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

http://opensource.adobe.com/spectrum-css/2.7.2/docs/#toast

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

Internet Explorer v11

Spectrum-CSS version

2.7.2

Sample Code that illustrates the problem

Screenshots (if applicable)

8c036418-103a-11e9-9d7d-ca2affb7c076

InputGroup: add Datepicker Range variant

Expected Behavior

Calendar supports range selection but Datepicker component does not display the date range.

Styling should support date range: http://spectrumprecursors.corp.adobe.com/submissions/date-date-range-picker

Add .spectrum-Datepicker--range and .spectrum-Datepicker--datetimeRange to .spectrum-InputGroup style definitions.

Update docs to support adding .is-focused style to InputGroup on focus, similar to how we do it for .spectrum-Slider.

Actual Behavior

Datepicker range variant does not exist.

Related JIRA issue

RSP-631
#20

Screenshots (if applicable)

Datepicker range InputGroup
Datepicker range InputGroup (Quiet variant)

Display Problems in CC 2017

Expected Behavior

In CC 2018 the search widget looks like this:
adobe_indesign_cc_2018

Actual Behavior

In CC 2017, it looks like this:
screenshot_1_24_19__11_21_am

All the SVG elements appear to be doubled up and one instance enlarged.

Reproduce Scenario (including but not limited to)

n/a

Steps to Reproduce

n/a

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

InDesign CC 2017 on Mac

Spectrum-CSS version

Latest

IE11 - dropdown incorrect width (quiet)

Expected Behavior

Dropdown should be same width as non-quiet variant.

Actual Behavior

Dropdown has 0 width due to flex issues

Reproduce Scenario (including but not limited to)

Dropdown--quiet in docs in IE11

Steps to Reproduce

Dropdown--quiet in docs in IE 11

Browser name/version/os (ie Chrome Version 62.0.3202.94 (Official Build) (64-bit) MacOS)

IE/11/Win 10

Spectrum-CSS version

2.7.2

Sample Code that illustrates the problem

N/A

Screenshots (if applicable)

screen shot 2019-01-16 at 10 58 13 am

Dead code comments in output

Expected Behavior

Output code doesn't have haha remove this and a bunch of other comments due to temporary variables.

Dead code should be removed, and unnecessary comments should be stripped. Furthermore, we should consider stripping the rest of the comments in output...

Actual Behavior

Ah, but it does.

Spectrum-CSS version

2.7.2

Screenshots (if applicable)

commons/skin.css:
image

every/component/in/the/library/most/skinfiles.css
image

Poor Scrolling Performance on CSS Demo/Documentation Page in Chrome/Safari

Expected Behavior

Scrolling through demos/documentation should be buttery smooth.

Actual Behavior

Scrolling is very jerky, making for a poor experience.

Reproduce Scenario (including but not limited to)

Visit the documentation and scroll in certain browsers.

Steps to Reproduce

  1. Open the documentation using Chrome or Safari.
  2. Navigate to the demo/documentation page.
  3. Scroll the page at high speed.

* Firefox 63 does not exhibit this issue, though its Performance developer tools may provide further insights when investigating.

Browser name/version/os

  • Chrome Version 70.0.3538.77 (Official Build) (64-bit)
  • Safari Version 12.0.1 (14606.2.104.1.1)

Both tested on macOS 10.14.1.

Spectrum-CSS version

2.5.1

Sample Code that illustrates the problem

N/A

Screenshots (if applicable)

N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.