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

Added support to disable suggestion selection #719

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jack-lewin
Copy link

I've picked up #440 to try and get it merged.

This PR adds an optional disabled prop to suggestions.

If a suggestion is disabled, it...

  • has a different style (reduced opacity, default cursor)
  • is not selectable & has aria-disabled = true
  • but still appears in the list

I've also...

  • added tests for the SuggestionsOverlay component & new functionality
  • updated the examples to disable one suggestion
  • updated the README accordingly

If this lands, I'll make a separate PR to the DefinitelyTyped repo.

Feedback appreciated - cc @mastrix, @Sigrsig and @steffektif 🙏

jack-lewin and others added 3 commits November 20, 2023 13:39
If a suggestion is disabled...
- Set aria-disabled=true
- Apply style
- Don't handle onSelect

Co-authored-by: Maks <sulimmaxim@gmail.com>
Copy link

changeset-bot bot commented Nov 20, 2023

🦋 Changeset detected

Latest commit: 47b3c68

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
react-mentions Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Nov 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-mentions ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 26, 2024 3:16pm

@jack-lewin
Copy link
Author

Hi @Sigrsig & @steffektif, sorry for the nudge - are you still maintaining this project?
If not, is there anyone else I should reach out to?

@steffektif
Copy link
Contributor

Hey sorry, already the last time you reached out I pinged some people. Currently @PreussHendrik and @crecotun are in charge. I hope they see this message and can help you out

@jack-lewin
Copy link
Author

Thanks a lot @steffektif - appreciate it 🙂

@jack-lewin
Copy link
Author

Hi, @PreussHendrik and @crecotun!

I'd really appreciate a review here - might one of you be able to take a look please?

Let me know if there's anything I can do to help get this merged.

@crecotun
Copy link

Hi @jack-lewin
Thank you for PR and for reaching out.
I'll do my best to review it soon.

@jialiu54321
Copy link

Thank you for working on this! Hope this gets merged soon!

@crecotun
Copy link

crecotun commented Aug 9, 2024

It was a busy 2 weeks; I'll have a look at PR today
@jialiu54321 @jack-lewin

(props) => ({
'&focused': props.focused,
'&disabled': Boolean(
typeof props.suggestion === 'string' ? false : props.suggestion.disabled
Copy link

Choose a reason for hiding this comment

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

Why do you check here if 'suggestion' is string before accessing disabled properly, but on a line 74, you don't?

Copy link
Author

Choose a reason for hiding this comment

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

Good catch @crecotun, thanks - I've added 47b3c68 to be more defensive here

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.

4 participants