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(web): disabled autoaccept should not autohighlight suggestions #13068

Merged
merged 1 commit into from
Jan 30, 2025
Merged
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
15 changes: 7 additions & 8 deletions web/src/engine/osk/src/banner/suggestionBanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ export class BannerSuggestion {
}

this.currentWidth = this.collapsedWidth;
this.highlight(suggestion?.autoAccept);
this.updateLayout();
}

Expand Down Expand Up @@ -557,13 +556,10 @@ export class SuggestionBanner extends Banner {

const autoselection = this._predictionContext.selected;
this._predictionContext.selected = null;
if(autoselection) {
this.options.forEach((entry) => {
if(entry.suggestion == autoselection) {
entry.highlight(false);
};
});
}
// Always clear pre-existing selections when a new banner input/gesture starts.
this.options.forEach((entry) => {
entry.highlight(false);
});

this.scrollState = new BannerScrollState(source.currentSample, this.container.scrollLeft);
const suggestion = source.baseItem;
Expand Down Expand Up @@ -753,6 +749,9 @@ export class SuggestionBanner extends Banner {
if(suggestions.length > i) {
const suggestion = suggestions[i];
d.update(suggestion, optionFormat);
if(this.predictionContext.selected == suggestion) {
d.highlight(true);
}
Comment on lines +752 to +754
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we instead replace the if-condition with suggestion?.autoHighlight, we can keep the "autocorrect hint" around in a cleaner way. Any interaction with the banner would instantly (and permanently) deselect it this way.

} else {
d.update(null, optionFormat);
}
Expand Down