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

When calling .select() on an option that's in a disabled optgroup - does not select option #7226

Closed
jennifer-shehane opened this issue May 5, 2020 · 2 comments · Fixed by #7146
Labels
pkg/driver This is due to an issue in the packages/driver directory type: bug

Comments

@jennifer-shehane
Copy link
Member

Current behavior:

We warn when attempting to select a disabled select or option, but not when option is within a disabled optgroup. So if you try to select an option within a disabled optgroup - it just has a null value.

Desired behavior:

If the option is within an optgroup that is disabled, the option is also disabled and should be warned.

Test code to reproduce

spec.js

it('works', () => {
  cy.visit('index.html')
  cy.get('#optgroup-enabled').select('okra')
    .invoke('val').should('eq', 'okra')   // passes
  cy.get('#optgroup-disabled').select('banana')
    .invoke('val').should('eq', 'banana') // fails
})

index.html

<html>
<body>
  <select id="optgroup-enabled">
    <optgroup label="Veggies">
      <option value="okra">Okra</option>
      <option value="zucchini">Zucchini</option>
    <optgroup>
  </select>
  <select id="optgroup-disabled">
    <optgroup label="Fruits" disabled>
      <option value="banana">Banana</option>
      <option value="apple">Apple</option>
    <optgroup>
  </select>
  <script>
  </script>
</body>
</html>

Screen Shot 2020-05-05 at 11 15 34 AM

Versions

4.5.0

@cypress-bot cypress-bot bot added the stage: work in progress There is an open PR for this issue [WIP] label May 5, 2020
@jennifer-shehane jennifer-shehane added the pkg/driver This is due to an issue in the packages/driver directory label May 5, 2020
@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: work in progress There is an open PR for this issue [WIP] and removed stage: work in progress There is an open PR for this issue [WIP] stage: needs review The PR code is done & tested, needs review labels May 5, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 8, 2020

The code for this is done in cypress-io/cypress#7146, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels May 8, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented May 20, 2020

Released in 4.6.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.6.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/driver This is due to an issue in the packages/driver directory type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant