[BUG] Disable click on <*Button>s when unauthorized
See original GitHub issueDescribe the bug
Right now my “basic user” should only be able to see (not edit) a list, and its detail.
Using <EditButton>
in the List actions column instead makes the button appear as disabled
(but still clickable).
When clicked you’re (of course) redirected to a 404 page.
I’d also love to have a prop on the Buttons (ListButton
, EditButton
, ShowButton
, DeleteButton
) (e.g showWhenUnauthorized
- default: true
) to avoid showing unauthorized buttons at all, as they should not be clicked by basic users, so it’ useless to even show them
Steps To Reproduce
- Setup providers to set “can: false” on some resource/actions
- Create a
<ShowButton>
or<EditButton>
for given resource/action - Click on the button
Expected behavior
You should
1- Not be redirected to a 404 page
2- (Even better) Not see the disabled button at all (maybe behind a showWhenUnauthorized
prop)
Screenshot
No response
Desktop
No response
Mobile
No response
Additional Context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Disabling the button after once click - Stack Overflow
I need to disable a button once it's clicked so the user can't click it more than once. (My application is written in...
Read more >[Bug] Button with disabled=True allows click from ... - GitHub
If a button is created with bind_return_key=True , it will still "click" using the Enter key even if it is disabled. To test,...
Read more >How to hide buttons for unauthorized users - Acorel
You must right click this method and “Redefine”: 7) In the code first call the super class. 8) Then put in code to...
Read more >Open a Mac app from an unidentified developer - Apple Support
Control-click the app icon, then choose Open from the shortcut menu. Click Open. The app is saved as an exception to your security...
Read more >Anypoint SAML SSO Error - Unauthorized: IDP-initiated SSO
SYMPTOM. While user click the "Back button" in browser after login into Anypoint Platform via SSO. it will show error of "Unauthorized: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @kino90, just merged #2838 to resolve this issue. I’ll ping once more when its released and hopefully confirm this is fixed. 🚀 🚀
Hey @kino90, disabled buttons should not be clickable and that should have been caught in the tests 🤦 Sorry for the issue, let me quickly check what we can do in short time 🙏 We’ll try to add an option to hide if unauthorized but it will be better for us to move that into a feature request 🚀