Skip to content

Commit

Permalink
[MIRROR] Fixes preferences tooltips (#1073)
Browse files Browse the repository at this point in the history
* Fixes preferences tooltips (#81571)

Fixes tooltips rendering under the main panel, could use some automated
handling for more complicated nested scenarios.
Also gives the panel default background color so the title is actually
visible (let me know if this is ugly)


![image](https://github.com/tgstation/tgstation/assets/4047233/448ee2c1-0299-499c-b47e-681f7cb7cbfc)

Fixes #80968

* Fixes preferences tooltips

---------

Co-authored-by: AnturK <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Feb 20, 2024
1 parent 2bb2cfd commit adc0b51
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion tgui/packages/tgui/components/Popper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ type OptionalProps = Partial<{
onClickOutside: () => void;
/** Where to place the popper relative to the reference element */
placement: Placement;
/** Base z-index of the popper div
* @default 5
*/
baseZIndex: number;
}>;

type Props = RequiredProps & OptionalProps;
Expand Down Expand Up @@ -85,7 +89,7 @@ export function Popper(props: PropsWithChildren<Props>) {
setPopperElement(node);
popperRef.current = node;
}}
style={{ ...styles.popper, zIndex: 5 }}
style={{ ...styles.popper, zIndex: props.baseZIndex ?? 5 }}
{...attributes.popper}
>
{content}
Expand Down
3 changes: 2 additions & 1 deletion tgui/packages/tgui/interfaces/PreferencesMenu/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ const ChoicedSelection = (props: {

return (
<Box
className="ChoicedSelection"
style={{
background: 'white',
padding: '5px',

height: `${
Expand Down Expand Up @@ -281,6 +281,7 @@ const MainFeature = (props: {
placement="bottom-start"
isOpen={isOpen}
onClickOutside={handleClose}
baseZIndex={1} // Below the default popper at z 2
content={
<ChoicedSelection
name={catalog.name}
Expand Down
5 changes: 5 additions & 0 deletions tgui/packages/tgui/styles/interfaces/PreferencesMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@use 'sass:map';
@use '../components/Button.scss';
@use '../colors.scss';
@use '../base.scss';

$department_map: (
'Assistant': colors.$grey,
Expand All @@ -16,6 +17,10 @@ $department_map: (
'Silicon': colors.$pink,
);

.ChoicedSelection {
background-color: base.$color-bg;
}

.PreferencesMenu {
&__Antags {
&__antagSelection {
Expand Down

0 comments on commit adc0b51

Please sign in to comment.