@@ -86,76 +86,75 @@ apiRunnerAsync(`onClientEntry`).then(() => {
86
86
/>
87
87
</ Router >
88
88
</ ScrollContext >
89
- < RouteAnnouncer location = { location } />
90
89
</ RouteUpdates >
91
90
) }
92
91
</ EnsureResources >
93
92
)
94
93
}
95
94
}
96
95
97
- class RouteAnnouncer extends React . Component {
98
- constructor ( props ) {
99
- super ( props )
100
- this . state = { announcement : `` }
101
- console . log ( `constructor` )
102
- }
103
-
104
- componentDidUpdate ( prevProps ) {
105
- console . log ( `did update` , this . props . location . pathname )
106
- if ( this . props . location . pathname !== prevProps . location . pathname ) {
107
- requestAnimationFrame ( ( ) => {
108
- console . log ( `updating` , this . props . location . pathname )
109
- let pageName = `new page at ${ this . props . location . pathname } `
110
- if ( document . title ) {
111
- pageName = document . title
112
- }
113
- const pageHeadings = document
114
- . getElementById ( `gatsby-focus-wrapper` )
115
- . getElementsByTagName ( `h1` )
116
- if ( pageHeadings ) {
117
- pageName = pageHeadings [ 0 ] . textContent
118
- }
119
- let newAnnouncement = `Navigated to ${ pageName } `
120
- if ( this . state . announcement !== newAnnouncement ) {
121
- console . log (
122
- `setting state` ,
123
- this . state . announcement ,
124
- newAnnouncement
125
- )
126
- this . setState ( {
127
- announcement : newAnnouncement ,
128
- } )
129
- }
130
- } )
131
- }
132
- }
133
-
134
- render ( ) {
135
- console . log ( `rendering` , this . props . location . pathname )
136
- const { announcement } = this . state
137
- return (
138
- < div
139
- id = "gatsby-announcer"
140
- style = { {
141
- position : `absolute` ,
142
- width : 1 ,
143
- height : 1 ,
144
- padding : 0 ,
145
- overflow : `hidden` ,
146
- clip : `rect(0, 0, 0, 0)` ,
147
- whiteSpace : `nowrap` ,
148
- border : 0 ,
149
- } }
150
- role = "alert"
151
- aria-live = "assertive"
152
- aria-atomic = "true"
153
- >
154
- { announcement }
155
- </ div >
156
- )
157
- }
158
- }
96
+ // class RouteAnnouncer extends React.Component {
97
+ // constructor(props) {
98
+ // super(props)
99
+ // this.state = { announcement: `` }
100
+ // console.log(`constructor`)
101
+ // }
102
+
103
+ // componentDidUpdate(prevProps) {
104
+ // console.log(`did update`, this.props.location.pathname)
105
+ // if (this.props.location.pathname !== prevProps.location.pathname) {
106
+ // requestAnimationFrame(() => {
107
+ // console.log(`updating`, this.props.location.pathname)
108
+ // let pageName = `new page at ${this.props.location.pathname}`
109
+ // if (document.title) {
110
+ // pageName = document.title
111
+ // }
112
+ // const pageHeadings = document
113
+ // .getElementById(`gatsby-focus-wrapper`)
114
+ // .getElementsByTagName(`h1`)
115
+ // if (pageHeadings) {
116
+ // pageName = pageHeadings[0].textContent
117
+ // }
118
+ // let newAnnouncement = `Navigated to ${pageName}`
119
+ // if (this.state.announcement !== newAnnouncement) {
120
+ // console.log(
121
+ // `setting state`,
122
+ // this.state.announcement,
123
+ // newAnnouncement
124
+ // )
125
+ // this.setState({
126
+ // announcement: newAnnouncement,
127
+ // })
128
+ // }
129
+ // })
130
+ // }
131
+ // }
132
+
133
+ // render() {
134
+ // console.log(`rendering`, this.props.location.pathname)
135
+ // const { announcement } = this.state
136
+ // return (
137
+ // <div
138
+ // id="gatsby-announcer"
139
+ // style={{
140
+ // position: `absolute`,
141
+ // width: 1,
142
+ // height: 1,
143
+ // padding: 0,
144
+ // overflow: `hidden`,
145
+ // clip: `rect(0, 0, 0, 0)`,
146
+ // whiteSpace: `nowrap`,
147
+ // border: 0,
148
+ // }}
149
+ // role="alert"
150
+ // aria-live="assertive"
151
+ // aria-atomic="true"
152
+ // >
153
+ // {announcement}
154
+ // </div>
155
+ // )
156
+ // }
157
+ // }
159
158
160
159
const { pagePath, location : browserLoc } = window
161
160
0 commit comments