Skip to content

Commit aa7d4b2

Browse files
committed
TSJR-217 - move skill selector menu into separate portal
1 parent 2bd1e62 commit aa7d4b2

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/apps/profiles/src/member-profile/skills/ModifySkillsModal/ModifySkillsModal.module.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
}
2929

3030
.skillsModalBody {
31-
overflow: visible !important;
31+
:global(.ms--value-container) {
32+
max-height: 90px;
33+
}
3234
}
3335

3436
.principalIntroLink {

src/libs/ui/lib/components/form/form-groups/form-input/input-multiselect/InputMultiselect.module.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,14 @@
127127
font-weight: $font-weight-medium;
128128
}
129129
}
130+
}
130131

132+
.ms {
133+
&:global(__menu-portal).ms:global(__menu-portal) {
134+
z-index: 1001;
135+
}
131136
&:global(__menu) {
132-
top: 100%;
133-
left: 0;
134-
position: absolute;
135137
width: 100%;
136-
z-index: 1;
137138
background-color: $tc-white;
138139
border-radius: 4px;
139140
box-shadow: 0px 4px 4px 0px rgba(0,0,0,0.25);

src/libs/ui/lib/components/form/form-groups/form-input/input-multiselect/InputMultiselect.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ const dropdownIndicator = (dropdownIcon: ReactNode): FC => (props: any) => (
8484
)
8585

8686
const InputMultiselect: FC<InputMultiselectProps> = props => {
87+
// we need to create a portal to append our menus so they are always visible
88+
const menuPortalTarget = useMemo(() => {
89+
const el = document.getElementById('input-ms-menu-target-portal') ?? document.createElement('div')
90+
el.id = 'input-ms-menu-target-portal'
91+
92+
if (!document.body.contains(el)) {
93+
document.body.append(el)
94+
}
95+
96+
return el
97+
}, [])
98+
8799
const asynSelectRef = useRef<any>()
88100
const placeholder = useMemo(() => (
89101
(props.value?.length as number) > 0 ? props.additionalPlaceholder ?? 'Add more...' : props.placeholder
@@ -132,6 +144,7 @@ const InputMultiselect: FC<InputMultiselectProps> = props => {
132144
props.useWrapper === false && styles.multiSelectWrap,
133145
)
134146
}
147+
classNames={{ valueContainer: () => 'ms--value-container' }}
135148
ref={props.inputRef ?? asynSelectRef}
136149
classNamePrefix={styles.ms}
137150
unstyled
@@ -156,6 +169,7 @@ const InputMultiselect: FC<InputMultiselectProps> = props => {
156169
openMenuOnClick={false}
157170
onKeyDown={handleKeyPress}
158171
filterOption={props.filterOption}
172+
menuPortalTarget={menuPortalTarget}
159173
/>
160174
)
161175

0 commit comments

Comments
 (0)