open-consul/ui
John Cowen a2fa60681a
ui: a11y modals (#9819)
This PR uses the excellent a11y-dialog to implement our modal functionality across the UI.

This package covers all our a11y needs - overlay click and ESC to close, controlling aria-* attributes, focus trap and restore. It's also very small (1.6kb) and has good DOM and JS APIs and also seems to be widely used and well tested.

There is one downside to using this, and that is:

We made use of a very handy characteristic of the relationship between HTML labels and inputs in order to implement our modals previously. Adding a for="id" attribute to a label meant you can control an <input id="id" /> from anywhere else in the page without having to pass javascript objects around. It's just based on using the same string for the for attribute and the id attribute. This allowed us to easily open our login dialog with CSS from anywhere within the UI without having to manage passing around a javascript object/function/method in order to open the dialog.

We've PRed #9813 which includes an approach which would make passing around JS modal object easier to do. But in the meantime we've added a little 'hack' here using an additional <input /> element and a change listener which allows us to keep this label/input characteristic of our old modals. I'd originally thought this would be a temporary amend in order to wait on #9813 but the more I think about it, the more I think its quite a nice thing to keep - so longer term we may/may not keep this.
2021-03-09 09:30:01 +00:00
..
packages/consul-ui ui: a11y modals (#9819) 2021-03-09 09:30:01 +00:00
.gitignore
GNUmakefile Trailing ui/vercel fixes (#9633) 2021-01-25 14:02:45 -05:00
README.md
package.json
vercel.json Update UI staging build for vercel hosting (#9628) 2021-01-25 13:46:20 -05:00
yarn.lock ui: a11y modals (#9819) 2021-03-09 09:30:01 +00:00

README.md

Consul UI Monorepo

This monorepo contains multiple projects, the UI for Consul and addons and packages used by the UI.

This top-level repository provides limited common tasks, such as installation and commit assistance. However, most tasks must be executed from within a subproject, e.g. running or testing.

Table of Contents generated with DocToc

Prerequisites

You will need the following things properly installed on your computer.

Installation

  • git clone https://github.com/hashicorp/consul.git this repository
  • cd ui
  • yarn

Yarn Commands

List of available project commands. yarn run <command-name>

Command Description
doc:toc Re-builds the ToC for this README.
compliance:licenses Checks that all dependencies have OSS-compatible licenses.

Contributing

Building ToC

To autogenerate a ToC (table of contents) for this README, run yarn doc:toc. Please update the ToC whenever editing the structure of README.