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 tabbing of tool settings #1236

Merged
merged 3 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/components-react",
"comment": "Fix an issue which prevented tabbing through editor containers.",
"type": "none"
}
],
"packageName": "@itwin/components-react"
}
8 changes: 8 additions & 0 deletions docs/changehistory/NextVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- [@itwin/appui-react](#itwinappui-react)
- [Additions](#additions)
- [Changes](#changes)
- [@itwin/components-react](#itwincomponents-react)
- [Fixes](#fixes)
- [@itwin/core-react](#itwincore-react)
- [Changes](#changes-1)

Expand All @@ -17,6 +19,12 @@

- Updated `cursorPromptTimeout` prop of `ToolAssistanceField` component to handle `Number.POSITIVE_INFINITY`, which when enabled will display the cursor prompt indefinitely. [#1211](https://github.com/iTwin/appui/pull/1211)

## @itwin/components-react

### Fixes

- Fixed an issue that unintentionally disabled tab navigation for tool settings. [#1236](https://github.com/iTwin/appui/pull/1236)

## @itwin/core-react

### Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export function EditorContainer(props: EditorContainerProps) {

const editorRef = React.useRef<TypeEditor | undefined>();
const propertyEditorRef = React.useRef<PropertyEditorBase | undefined>();
const committedByTab = React.useRef(false);

const handleClick = (e: React.MouseEvent) => {
onClick?.();
Expand Down Expand Up @@ -148,8 +149,8 @@ export function EditorContainer(props: EditorContainerProps) {
const onPressTab = (e: React.KeyboardEvent) => {
if (!propertyEditorRef.current?.containerHandlesTab) return;
e.stopPropagation();
e.preventDefault();
void handleContainerCommit();
committedByTab.current = true;
};

const handleKeyDown = (e: React.KeyboardEvent) => {
Expand All @@ -170,6 +171,11 @@ export function EditorContainer(props: EditorContainerProps) {
};

const handleEditorBlur = () => {
// Avoid double commit when tabbing.
if (committedByTab.current) {
committedByTab.current = false;
return;
}
if (ignoreEditorBlur) return;
if (!propertyEditorRef.current?.containerHandlesBlur) return;
void handleContainerCommit();
Expand Down