Skip to content

DEV: floatkit autocomplete for ai-bot-conversations #34354

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

Merged
merged 2 commits into from
Aug 19, 2025

Conversation

tyb-talks
Copy link
Contributor

@tyb-talks tyb-talks commented Aug 15, 2025

This PR changes the ai-bot-conversations component to use the floatkit-based autocomplete menu for the AI bot chat interface when autocompleting hashtags (#) and mentions (@).

Preferably to be reviewed/merged after #34131 which introduces better positioning & an offset option that aligns with the UI here as well.

Also fixes a bug where autocompleting in the full page search input field results in the search immediately submitting.

autocomplete-ai-2.mov

@tyb-talks tyb-talks force-pushed the dev-floatkit-autocomplete-discourse-ai branch from 5f9b51a to 44864e8 Compare August 15, 2025 07:39
@tyb-talks tyb-talks force-pushed the dev-floatkit-autocomplete-discourse-ai branch from 44864e8 to 276807c Compare August 18, 2025 02:01
@tyb-talks tyb-talks marked this pull request as ready for review August 18, 2025 03:24
},
onClose: destroyUserStatuses,
});
if (!this.siteSettings.floatkit_autocomplete_chat_composer) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Decided not to DRY the options passed into this block as it makes for a cleaner git history when we remove the jquery-based autocomplete and also there's a slightly different options API here treatAsTextarea for the jquery-based autocomplete vs fixedTextareaPosition/offset for floatkit-based autocomplete.

@@ -122,6 +122,7 @@ export default class DAutocompleteModifier extends Modifier {
case "Enter":
case "Tab":
event.preventDefault();
event.stopImmediatePropagation();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without this, the AI chat interface submits the entire input on autocompletion of the term (must be some other event listener set on that element/keypress). This does not occur in chat/topic composers, only AI chat interface and full page search.

@nattsw
Copy link
Contributor

nattsw commented Aug 18, 2025

Hmm the video shows the text space expanding before first key. Is that intended? It isn't the case now in prod.

@tyb-talks
Copy link
Contributor Author

Hmm the video shows the text space expanding before first key. Is that intended? It isn't the case now in prod.

I accidentally clicked ctrl+enter 😅, can see how that's confusing. Will do a clearer recording tomorrow 😁

@tyb-talks tyb-talks merged commit a3bc8c8 into main Aug 19, 2025
19 checks passed
@tyb-talks tyb-talks deleted the dev-floatkit-autocomplete-discourse-ai branch August 19, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants