I have a <button> that is disabled but the on="tap:..." is triggered if the button has a child-component - not if it is only containing text.
<button disabled on="tap:AMP.setState({visible: !visible})">
<p>Toggle text (disabled not working)</p>
</button>
Made a JSFiddle demoing it: http://jsbin.com/loyexarifo/1/edit?html,output
AMP version: 1500510703681
/to @choumx
Sounds like a very good idea to prevent actions on disabled buttons. WDYT?
Interestingly enough my reading of spec
A form control that is disabled must prevent any click events that are queued on the user interaction task source from being dispatched on the element.
But events definitely come through. So I think we should definitely implement the blocking here.
Agreed. Should be a simple fix in action-impl.js:
disabled attribute when traversing up the event target's parent chain in ActionService#findAction_().@robinpokorny Now that you've completed your first GFI, this is a "good second issue" to tackle and gives you some insight into our Actions service in AMP (an important part for interactive AMP pages). Please let me know if you have any questions.
Hello,
I have a use case where I want to disable an input field, but allow clicking on it to trigger a lightbox with advanced search.
Anything I can do to have the input field un-typable and also have it it react to tap events?
@dvoytenko @choumx
Nevermind, I just replaced the input element with a styled div.