Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Designer): Keyboard focus move outside of 'Insert dynamic content' dialog #6303

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions libs/designer-ui/src/lib/tokenpicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { TokenPickerHeader } from './tokenpickerheader';
import { TokenPickerPivot } from './tokenpickerpivot';
import type { GetValueSegmentHandler } from './tokenpickersection/tokenpickeroption';
import { TokenPickerSection } from './tokenpickersection/tokenpickersection';
import type { ICalloutContentStyles, ISearchBox, PivotItem } from '@fluentui/react';
import { SearchBox, DirectionalHint, Callout } from '@fluentui/react';
import type { ICalloutContentStyles, IFocusTrapZoneProps, ISearchBox, PivotItem } from '@fluentui/react';
import { SearchBox, DirectionalHint, FocusTrapCallout } from '@fluentui/react';
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
import { $getSelection, type LexicalEditor, type NodeKey } from 'lexical';
import { useEffect, useRef, useState } from 'react';
Expand Down Expand Up @@ -222,14 +222,17 @@ export function TokenPicker({
description: 'Button text for the create expression with copilot feature',
});

const focusTrapProps: IFocusTrapZoneProps = { isClickableOutsideFocusTrap: true };

const nl2fExpressionPane = (
<Callout
<FocusTrapCallout
role="dialog"
ariaLabelledBy={labelId}
gapSpace={gapSpace}
target={`#${editorId}`}
beakWidth={beakWidth}
directionalHint={directionalHint}
focusTrapProps={focusTrapProps}
onMouseMove={handleExpressionEditorMoveDistance}
onMouseUp={() => {
if (isDraggingExpressionEditor) {
Expand Down Expand Up @@ -277,7 +280,7 @@ export function TokenPicker({
setExpressionEditorError={setExpressionEditorError}
/>
</div>
</Callout>
</FocusTrapCallout>
);

if (isNl2fExpression) {
Expand All @@ -286,13 +289,14 @@ export function TokenPicker({

return (
<>
<Callout
<FocusTrapCallout
role="dialog"
ariaLabelledBy={labelId}
gapSpace={gapSpace}
target={`#${editorId}`}
beakWidth={beakWidth}
directionalHint={directionalHint}
focusTrapProps={focusTrapProps}
onMouseMove={handleExpressionEditorMoveDistance}
onMouseUp={() => {
if (isDraggingExpressionEditor) {
Expand Down Expand Up @@ -414,7 +418,7 @@ export function TokenPicker({
) : null}
</div>
</div>
</Callout>
</FocusTrapCallout>
{tokenClickedCallback ? null : <TokenPickerHandler handleUpdateExpressionToken={handleUpdateExpressionToken} />}
{tokenClickedCallback ? null : <UpdateTokenNode />}
</>
Expand Down
Loading