- Go to chrome://flags/#enable-devtools-experiments and click 'Enable'. This will turn on the experiment in your version of Chrome.
- Restart Chrome.
- Open your DevTools and click the three vertical dots in the top right to open the context menu.
- Click on 'Settings'.
- Click on the 'Experiments' tab on the left hand side.
- Check the box next to 'Accessibility Inspection'.
- Close the DevTools, then reopen them.
- You're all set! Go inspect an element in the Elements panel and you should see a new 'Accessibility' tab over near the Style inspector.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<custom-listbox role="listbox" | |
aria-describedby="generated-id1 generated-id2" | |
aria-activedescendant="generated-id3"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// default role is "slider" | |
// set using private accessibleNode by the element author | |
<custom-slider id="mySlider"> | |
// element consumer changes role to "button" | |
mySlider.accessibleNode.role = "button" | |
// element consumer nulls role | |
mySlider.accessibleNode.role = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomSlider extends HTMLElement { | |
constructor() { | |
super(); | |
this.accessibleNode.role = 'slider'; | |
this.accessibleNode.valueMin = 0; | |
this.accessibleNode.valueMax = 5; | |
this.accessibleNode.valueNow = 3; | |
this.accessibleNode.valueText = 3; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<custom-slider min="0" max="5" value="3" role="slider" | |
tabindex="0" aria-valuemin="0" aria-valuemax="5" | |
aria-valuenow="3" aria-valuetext="3"></custom-slider> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Hello World</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<my-element></my-element> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- src/my-element.html --> | |
<link rel="import" href="../bower_components/polymer/polymer-element.html"> | |
<dom-module id="my-element"> | |
<template> | |
<h1>Hello, World! It's [[today]].</h1> | |
</template> | |
<script type=”module”> | |
// Heyyyy, we're pulling in a Node module! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* webpack.config.js */ | |
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
var CopyWebpackPlugin = require('copy-webpack-plugin'); | |
var path = require('path'); | |
module.exports = { | |
// Tell Webpack which file kicks off our app. | |
entry: path.resolve(__dirname, 'src/index.js'), | |
// Tell Weback to output our bundle to ./dist/bundle.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Hello World</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<my-element></my-element> |
In this scenario you're just trying to bootstrap a Custom Element with some data so it can render as soon as it hits the page. You don't have the ability to set properties, so serializing objects and arrays to string attributes seems like the only way to do it? Custom Elements could be written to expect this and call JSON.parse on their obj/arr observed attributes.