mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Merge pull request #34565 from overleaf/em-bibtex-modal-scroll
Make BibTeX modals scrollable GitOrigin-RevId: 3ef2d2e7ac5e481c0e31c937b62ff4467c23f220
This commit is contained in:
@@ -25,7 +25,7 @@ export default function FocusTrap({
|
||||
fallbackFocus: () => containerRef.current as HTMLElement,
|
||||
}}
|
||||
>
|
||||
<div ref={containerRef} tabIndex={-1}>
|
||||
<div ref={containerRef} className="focus-trap-container" tabIndex={-1}>
|
||||
{children}
|
||||
</div>
|
||||
</FocusTrapReact>
|
||||
|
||||
@@ -34,6 +34,10 @@ export type OLAutocompleteProps = {
|
||||
expandUp?: boolean
|
||||
onClose?: () => void
|
||||
isOpen?: boolean
|
||||
scrollIntoView?: (
|
||||
node: HTMLElement | null,
|
||||
menuNode: HTMLElement | null
|
||||
) => void
|
||||
}
|
||||
|
||||
type OLAutocompleteDisplayItem =
|
||||
@@ -61,6 +65,7 @@ function OLAutocompleteInternal({
|
||||
expandUp = false,
|
||||
onClose,
|
||||
isOpen: controlledIsOpen,
|
||||
scrollIntoView,
|
||||
}: OLAutocompleteProps) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
@@ -143,6 +148,7 @@ function OLAutocompleteInternal({
|
||||
items: displayItems,
|
||||
defaultHighlightedIndex: 0,
|
||||
...(controlledIsOpen !== undefined && { isOpen: controlledIsOpen }),
|
||||
...(scrollIntoView !== undefined && { scrollIntoView }),
|
||||
itemToString: item => {
|
||||
if (!item) return ''
|
||||
return item.type === 'create' ? item.inputValue : item.label
|
||||
|
||||
@@ -33,6 +33,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
// OLModal wraps children in a FocusTrap that renders a <div> between
|
||||
// .modal-content and .modal-header/.modal-body/.modal-footer, breaking
|
||||
// Bootstrap's flex chain for scrollable modals. display: contents makes the
|
||||
// wrapper invisible to the layout engine so Bootstrap's flex/overflow chain
|
||||
// reaches .modal-body correctly.
|
||||
.modal-dialog-scrollable .modal-content > .focus-trap-container {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
@include shadow-lg;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user