Don't call top-nav button's run function if disabled#8084
Don't call top-nav button's run function if disabled#8084ycombinator merged 6 commits intoelastic:masterfrom
Conversation
This prevents the menuItem.run() function from being executed if the button is clicked.
|
LGTM, thanks @ycombinator |
|
Unfortunately using |
|
@markharwood This is ready for review again. Thanks! |
|
It looks not to trigger the action when clicked but being super-picky it is less "disabled" in appearance/behaviour - it still accepts focus whereas the previous commit didn't. |
Yeah, this is true. Let me see if I can achieve both objectives - make the element not accept focus but also render the tooltip when disabled . |
|
@markharwood I made a CSS change to prevent disabled buttons from appearing to accept focus, while also preserving the ability for tooltips to be shown on disabled buttons. Ready for your review again :) |
|
Regardless of the styling I have a general suspicion the it doesn't toggle menu states when ..it clearly does enable/disable with changes to the model. |
|
Hi @markharwood, I chatted with @cjcenizal about the styling and whether we should use Unfortunately we can't really use I also discussed with CJ your point about not being able to tab through disabled buttons. I think removing the So I'm going to do this next:
|
|
@cjcenizal @markharwood I've made style + some code changes per CJ's suggestions and I've also implemented the capability for button enabled/disabled state to be responsive to Angular model changes per Mark's findings. This is ready for review again. |
|
Beautiful! LGTM. |
|
LGTM too |
Don't call top-nav button's run function if disabled Former-commit-id: a95554f
When the disabled functionality for top nav buttons was created, it was only tested with top nav buttons that provide a
template. It was not tested with top nav elements that provide arunfunction. Consequently, it turned out that therunfunction was being executed when its top nav button was clicked, even if that button was disabled, which is a bug.This PR fixes that bug.
UPDATE: It also makes the toggling of enabled/disabled state a function of model changes, not just route/page reload.