Fix focus ring styling
This commit is contained in:
parent
412d9258e9
commit
12cc844758
2 changed files with 24 additions and 1 deletions
22
src/App.jsx
22
src/App.jsx
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from "react";
|
import React, { useEffect } from "react";
|
||||||
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
|
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
|
||||||
import * as Sentry from "@sentry/react";
|
import * as Sentry from "@sentry/react";
|
||||||
import { OverlayProvider } from "@react-aria/overlays";
|
import { OverlayProvider } from "@react-aria/overlays";
|
||||||
|
@ -23,6 +23,9 @@ import { LoginPage } from "./LoginPage";
|
||||||
import { RegisterPage } from "./RegisterPage";
|
import { RegisterPage } from "./RegisterPage";
|
||||||
import { Room } from "./Room";
|
import { Room } from "./Room";
|
||||||
import { ClientProvider } from "./ConferenceCallManagerHooks";
|
import { ClientProvider } from "./ConferenceCallManagerHooks";
|
||||||
|
import { useFocusVisible } from "@react-aria/interactions";
|
||||||
|
import classNames from "classnames";
|
||||||
|
import styles from "./App.module.css";
|
||||||
|
|
||||||
const SentryRoute = Sentry.withSentryRouting(Route);
|
const SentryRoute = Sentry.withSentryRouting(Route);
|
||||||
|
|
||||||
|
@ -31,6 +34,23 @@ const { protocol, host } = window.location;
|
||||||
const homeserverUrl = `${protocol}//${host}`;
|
const homeserverUrl = `${protocol}//${host}`;
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
|
const { isFocusVisible } = useFocusVisible();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const classList = document.body.classList;
|
||||||
|
const hasClass = classList.contains(styles.hideFocus);
|
||||||
|
|
||||||
|
if (isFocusVisible && hasClass) {
|
||||||
|
classList.remove(styles.hideFocus);
|
||||||
|
} else if (!isFocusVisible && !hasClass) {
|
||||||
|
classList.add(styles.hideFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
classList.remove(styles.hideFocus);
|
||||||
|
};
|
||||||
|
}, [isFocusVisible]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<ClientProvider homeserverUrl={homeserverUrl}>
|
<ClientProvider homeserverUrl={homeserverUrl}>
|
||||||
|
|
3
src/App.module.css
Normal file
3
src/App.module.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.hideFocus * {
|
||||||
|
outline: none;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue