Git Product home page Git Product logo

howto-components's Introduction

HowTo: Components

Travis CI Build status badge

“HowTo: Components” is a subsection on Web Fundamentals Architecture section, containing a collection of web components that implement common web UI patterns using modern web technologies like Custom Elements v1 and ESnext with a special focus on accessibility, performance and progressive enhancement. Their purpose is to be an educational resource. Users are supposed to read and learn from their implementations. They are explicitly NOT a UI library meant to be used in production.

Demos

You can run the demos locally, after you build them:

npm install  # if you haven't already
npm run build
python -m SimpleHTTPServer  # or your favourite local server

In your browser, navigate to http://localhost:8000/docs (or the port that you're running the local server from.)

You can also run

npm run watch

to continuously run the build whenever a file changes.

WebFundamentals

To generate the content for WebFundamentals, run the build-webfundamentals.sh script. It will create a webfundamentals folder. The contents needs to be moved into the WebFundamentals repository. If new components have been created, they need to be added manually to WebFundamentals Web Components table of contents.

Testing

Tests are written using Mocha and Chai. Each component has tests.

Local

Tests run using Karma. Run the tests with

$ npm test

This assumes that Chrome, Firefox and Safari are installed as the tests run in all of these browser (using the Custom Elements v1 Polyfill).

Local + Docker (or Travis)

Tests can also run in a Docker container (as we do on Travis):

$ npm run docker

This builds a docker image googlechrome/howto-components and runs it. The dockerized tests use Chrome only.

Staging

All branches and PRs are built and uploaded on Travis CI. The staged version can be viewed at http://dash-elements.surma.link/<commit hash>.

License

Copyright 2017 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Please note: this is not a Google product

howto-components's People

Contributors

bkardell avatar devnook avatar notwaldorf avatar rajatsehgal avatar robdodson avatar sendilkumarn avatar surma 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

howto-components's Issues

Give feedback on AOM attribute reflection rules.

The thread is super long but tl;dr:

We're trying to figure out if someone has both AOM and ARIA on an element, which one should win. Answering this question is incredibly difficult. But howto-components are well positioned to try out the various suggestions and give feedback to the standard.
WICG/aom#60 (comment)

Add ESLint and/or JSCS

I figure with enough folks working on this we'll quickly hit a point where there are code style conflicts. Would be nice to add these in early to validate any incoming PRs.

<howto-combobox>

Tracking bug for <howto-combobox>

TODO:

  • Update to all the new patterns, styles etc etc

<howto-menu> needs more robust example

From Rob:
I'd really like to see an example of at least one nested menu item that uses aria-haspopup.

In general we've tried to avoid developers needing to write out ARIA attributes themselves, so it might be a good use case to create a element that automatically self applies aria-haspopup if it has children.

Variations

I'd like to show two different radio groups, 1 using roving tabindex and 1 using aria-activedescendant. What do you all think would be the best way to handle variations of a pattern?

[Question] HowTo-Components vs Polymer Components Library

Hi,
I am really curious about the goal of such example library which seems to be fully focused on Javascipt ES6.
Do you pave the way to an upcoming migration of Polymer elements in pure 2.0 implementation?
Do you recommend to progressively move away from HTML for Web Component development in general?
Cheers,
Pascal

Use consistent language in the comments.

There are a number of places where elements are referred to as HowToTree versus <howto-tree>. Need to be consistent throughout. I think I prefer using <howto-tree> instead of the class names everywhere.

[tab-panel] Use CEs for inner elements

By @robdodson:

I'd be curious to see if it's possible to build the entire structure out of custom elements, something like:

<dash-tabs>
  <dash-tab></dash-tab>
  <dash-tabpanel></dash-tabpanel>
</dash-tabs>

You could do some (possibly weird 😄 ) things for PE like give the tab a role=heading explicitly in markup, but then that gets swapped out with role=tab when the element upgrades. The more I think about this the more I kinda like this idea. It seems to dovetail well into the PE use case because it's saying "if JS doesn't load, this thing's role is something more basic, but if js does load, it's new role is more advanced". Most importantly it gives the user a signal that the thing is now keyboard interactive.

Review Tab Panel

My tab panel pretty much made it to the repo without any actual reviews. I’d appreciate if either of you would give it a look to make sure I’m not doing random crap.

Handling :unresolved FOUC-like state

I've noticed every time I load the docs for an element the first time I briefly get the unupgraded version, quickly followed by the upgraded version. This usually causes the page to flash two different layouts. But I don't think in the real world this behavior would be desirable. For a page with a lot of CEs it's going to cause a bunch of things to move around on first load.

I'm not sure the best solution tbh.

Elements should not rely on ARIA attributes for styling or behavior.

In earlier elements like <howto-radio-group>, I relied on aria-* for styling and behavior. Instead, ARIA should be an implementation detail.

So instead of styling aria-checked I would expose a checked attribute/property on the element, and style that. Setting checked would, as a side effect, also set aria-checked. We should use this pattern throughout.

  • Accordion
  • Checkbox
  • Radio Group
  • Tabs
  • Tooltip
  • Tree

[Q] Why skip keyboard processing on alt-key?

Making issue because @robdodson looped in @alice:

Looking at the JS implementation of OAA’s tab panel they are skipping their keyboard processing code when the alt key is pressed. Any idea why that is?

tabpanel.prototype.handleTabKeyPress = function($tab, e) { 
  if (e.altKey) { 
    // do nothing 
    return true; 
  } 

  switch (e.keyCode) { 
  // ...
  }
}

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.