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

don't click when disabled #384

Merged
merged 1 commit into from
Jun 9, 2018
Merged

don't click when disabled #384

merged 1 commit into from
Jun 9, 2018

Conversation

kellyselden
Copy link
Member

Closes #383.

Probably affects other helpers.

@@ -59,7 +59,10 @@ export default function click(target) {
throw new Error(`Element not found when calling \`click('${target}')\`.`);
}

__click__(element);
if (!element.hasAttribute('disabled')) {
Copy link
Member

Choose a reason for hiding this comment

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

I think it should check the property instead of the attribute 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@cibernox
Copy link
Contributor

cibernox commented Jun 9, 2018

I'm confused. I understand that disabled inputs can't be filled, but can't they be clicked? That's surprising

@Turbo87
Copy link
Member

Turbo87 commented Jun 9, 2018

@cibernox I think you're confusing disabled with readonly

@cibernox
Copy link
Contributor

cibernox commented Jun 9, 2018

I'm not. I only expected disabled inputs to not be fillable or focusable, I didn't know they weren't clickable

@@ -59,7 +59,10 @@ export default function click(target) {
throw new Error(`Element not found when calling \`click('${target}')\`.`);
}

__click__(element);
if (!element.disabled) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to do something like:

let isDisabledFormControl = isFormControl(element) && element.disabled === true;

if (!isDisabledFormControl) {
  __click__(element);
}

Specifically, adding disabled to random elements doesn't have an effect (e.g. <div disabled></div> still fires events) as it isn't a global attribute. AFAIK disabled is only a thing for form controls...

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@rwjblue rwjblue merged commit 762692c into emberjs:master Jun 9, 2018
@rwjblue
Copy link
Member

rwjblue commented Jun 9, 2018

Thank you @kellyselden!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants