Skip to content

Instantly share code, notes, and snippets.

@yuschick
Last active November 9, 2017 06:59
Show Gist options
  • Save yuschick/64c52db5f6e3025783ec1fd37caf8504 to your computer and use it in GitHub Desktop.
Save yuschick/64c52db5f6e3025783ec1fd37caf8504 to your computer and use it in GitHub Desktop.
Accessible Web Apps with React, TypeScript & Ally.js
interface AppState {
showDialog: boolean;
}
class App extends React.Component<{}, AppState> {
state: AppState;
constructor(props: {}) {
super(props);
this.state = {
showDialog: false
};
}
toggleDialog() {
this.setState({ showDialog: !this.state.showDialog });
}
render() {
return (
<div className="site-container">
<header>
<h1>Ally.js with React &amp; Typescript</h1>
</header>
<main className="content-container">
<div className="field-container">
<label htmlFor="name-field">Name:</label>
<input type="text" id="name-field" placeholder="Enter your name" />
</div>
<div className="field-container">
<label htmlFor="food-field">Favourite Food:</label>
<input type="text" id="food-field" placeholder="Enter your favourite food" />
</div>
<div className="field-container">
<button
className='btn primary'
tabIndex={0}
title='Open Dialog'
onClick={() => this.toggleDialog()}
>
Open Dialog
</button>
</div>
</main>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment