Skip to content

Commit

Permalink
fix site.dialog containing an auto-completer
Browse files Browse the repository at this point in the history
like the study invite form dialog. It truncated the completion list
due to the scrollable dialog div
  • Loading branch information
ornicar committed May 9, 2024
1 parent 90147fc commit 8cb4289
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions ui/@types/lichess/dialog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface DialogOpts {
onClose?: (dialog: Dialog) => void; // called when dialog closes
noCloseButton?: boolean; // if true, no upper right corner close button
noClickAway?: boolean; // if true, no click-away-to-close
noScrollable?: boolean; // if true, no scrollable div container. Fixes dialogs containing an auto-completer
}

interface DomDialogOpts extends DialogOpts {
Expand Down
1 change: 1 addition & 0 deletions ui/analyse/src/study/inviteForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function view(ctrl: ReturnType<typeof makeCtrl>): VNode {
ctrl.open(false);
ctrl.redraw();
},
noScrollable: true,
vnodes: [
h('h2', ctrl.trans.noarg('inviteToTheStudy')),
h(
Expand Down
4 changes: 2 additions & 2 deletions ui/site/src/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function domDialog(o: DomDialogOpts): Promise<Dialog> {
for (const [k, v] of Object.entries(o.attrs?.view ?? {})) view.setAttribute(k, String(v));
if (html) view.innerHTML = html;

const scrollable = $as<Element>('<div class="scrollable">');
const scrollable = $as<Element>(`<div class="${o.noScrollable ? 'not-' : ''}scrollable">`);
scrollable.appendChild(view);
dialog.appendChild(scrollable);

Expand Down Expand Up @@ -66,7 +66,7 @@ export function snabDialog(o: SnabDialogOpts): VNode {
h('button.close-button', { attrs: { 'data-icon': licon.X, 'aria-label': 'Close' } }),
),
h(
'div.scrollable',
`div.${o.noScrollable ? 'not-' : ''}scrollable`,
h(
'div.dialog-content' +
(o.class
Expand Down

0 comments on commit 8cb4289

Please sign in to comment.