Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit c118a48

Browse files
author
george
committed
remove duplicate focus outline instance in Article component + disableFocusOutline on componentWillUnmount
1 parent f5725e2 commit c118a48

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

app/components/Article/Article.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,30 @@ import ScrollUpOnMount from "app/components/ScrollUpOnMount"
1010
export default class Article extends React.Component {
1111
constructor() {
1212
super()
13+
1314
this.state = {
1415
domIsLoaded: false,
1516
}
1617
}
1718

19+
COMPONENTS = ["Tooltips", "Accordions", "Modals", "Dropdowns"]
20+
1821
static propTypes = {
1922
children: PropTypes.any,
2023
}
2124

2225
componentDidMount() {
23-
Undernet.start()
2426
Prism.highlightAll()
2527

26-
this.setState({
27-
domIsLoaded: true,
28-
})
28+
// initialize all Undernet components
29+
// DO NOT init focus outline - it is set up in layouts/Main
30+
this.COMPONENTS.forEach(component => Undernet[component].start())
31+
32+
this.setState({ domIsLoaded: true })
2933
}
3034

3135
componentWillUnmount() {
32-
Undernet.stop()
36+
this.COMPONENTS.forEach(component => Undernet[component].stop())
3337
}
3438

3539
render() {

app/docs/buttons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Also in the same map as `$button-types`, you can find status buttons. By default
9191

9292
## Links
9393

94-
Add styles for your regular anchor links. Use the helper class `link` to style text as a link.
94+
Control the look and feel of your links as well. They don't require any modifier classes.
9595

9696
<a href="#0">Just a link!</a>
9797

app/layouts/Main/Main.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import "./styles.scss"
1414
import { FOCUSABLE_TABINDEX, UNFOCUSABLE_TABINDEX } from "./constants"
1515

1616
export default class Main extends React.Component {
17-
constructor(props) {
18-
super(props)
17+
constructor() {
18+
super()
1919

2020
this.state = {
2121
headerTabIndex: UNFOCUSABLE_TABINDEX,
@@ -30,6 +30,10 @@ export default class Main extends React.Component {
3030
ContextUtil.enableFocusOutline()
3131
}
3232

33+
componentWillUnmount() {
34+
ContextUtil.disableFocusOutline()
35+
}
36+
3337
handleHeaderFocusClick = event => {
3438
event.preventDefault()
3539

0 commit comments

Comments
 (0)