Skip to content

Commit

Permalink
update constant to be generic
Browse files Browse the repository at this point in the history
  • Loading branch information
gilluminate committed Apr 9, 2024
1 parent 8d923eb commit a069185
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions clients/fides-js/src/components/LanguageSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { I18n } from "../lib/i18n";
import { useI18n } from "../lib/i18n/i18n-context";
import { debugLog, FidesInitOptions } from "../fides";
import MenuItem from "./MenuItem";
import { FIDES_A11Y_CONSTANTS } from "../lib/consent-constants";
import { FIDES_OVERLAY_WRAPPER } from "../lib/consent-constants";

interface LanguageSelectorProps {
i18n: I18n;
Expand All @@ -17,7 +17,7 @@ const LanguageSelector = ({ i18n, options }: LanguageSelectorProps) => {
if (locale !== i18n.locale) {
i18n.activate(locale);
setCurrentLocale(locale);
document.getElementById(FIDES_A11Y_CONSTANTS.FIDES_REFOCUS_EL)?.focus();
document.getElementById(FIDES_OVERLAY_WRAPPER)?.focus();
debugLog(options.debug, `Fides locale updated to ${locale}`);
}
};
Expand Down
4 changes: 2 additions & 2 deletions clients/fides-js/src/components/Overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import ConsentModal from "./ConsentModal";
import ConsentContent from "./ConsentContent";
import "./fides.css";
import { blockPageScrolling, unblockPageScrolling } from "../lib/ui-utils";
import { FIDES_A11Y_CONSTANTS } from "../lib/consent-constants";
import { FIDES_OVERLAY_WRAPPER } from "../lib/consent-constants";

interface RenderBannerProps {
isOpen: boolean;
Expand Down Expand Up @@ -192,7 +192,7 @@ const Overlay: FunctionComponent<Props> = ({
}

return (
<div id={FIDES_A11Y_CONSTANTS.FIDES_REFOCUS_EL} tabIndex={-1}>
<div id={FIDES_OVERLAY_WRAPPER} tabIndex={-1}>
{showBanner && bannerIsOpen && isUiBlocking && (
<div className="fides-modal-overlay" />
)}
Expand Down
4 changes: 1 addition & 3 deletions clients/fides-js/src/lib/consent-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,4 @@ export const FIDES_OVERRIDE_EXPERIENCE_LANGUAGE_VALIDATOR_MAP: {
},
];

export const FIDES_A11Y_CONSTANTS = {
FIDES_REFOCUS_EL: "fides-refocus-el",
};
export const FIDES_OVERLAY_WRAPPER = "fides-overlay-wrapper";

0 comments on commit a069185

Please sign in to comment.