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

Autocomplete loadout hashtags in loadout drawer #8918

Merged

Conversation

robojumper
Copy link
Member

@robojumper robojumper commented Jan 3, 2023

Pulled out of #8916. The textcomplete package doesn't support <input /> out of the box, but the code basically works fine even when the types don't say it, so a cast makes it work.

grafik
grafik

@robojumper
Copy link
Member Author

robojumper commented Jan 6, 2023

So textcomplete's TextareaEditor is written for a <textarea /> but it seems (Edge, Firefox) to also work fine with an <input type="text" />, so lying about the types works. The code is spread across three different packages in three different repos, so upstreaming <input /> support is not that simple. Not sure what the best approach is -- we could also just copy a bunch of code into DIM but it'd basically need no changes other than type signature adjustments.

Would be good to test this in other browsers though.

@bhollis
Copy link
Contributor

bhollis commented Jan 7, 2023

Hmm - we used to use this for autocomplete in the main search bar, which was a regular text input. But maybe that was a previous version of the library.

if (textArea.current) {
// commit a type crime here because textcomplete says it only works with
// TextArea but happens to also work entirely fine with Input[type=text]
const editor = new TextareaEditor(textArea.current as unknown as HTMLTextAreaElement);
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@bhollis bhollis left a comment

Choose a reason for hiding this comment

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

Very cool

@robojumper robojumper force-pushed the loadout-hashtags-autocomplete branch from 16bdb7f to 1796fb6 Compare January 9, 2023 08:06
@robojumper robojumper merged commit 7080940 into DestinyItemManager:master Jan 9, 2023
@robojumper robojumper deleted the loadout-hashtags-autocomplete branch January 9, 2023 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants