Capybara: Rack driver treats fieldset[disabled] fields as enabled

Created on 29 Dec 2016  路  5Comments  路  Source: teamcapybara/capybara

Meta

Capybara Version: 2.7.1
Driver Information (and browser if relevant): rack-driver

Expected Behavior

Descendant fields of <fieldset disabled> should be treated as disabled too by rack-driver.

(Reference: disabled attribute https://developer.mozilla.org/en/docs/Web/HTML/Element/fieldset#Attributes)

Actual Behavior

Descendant fields of <fieldset disabled> are treated as enabled by rack-driver.

Steps to reproduce

<form action="/">
  <fieldset disabled="disabled">
    <label for="email">Email</label>
    <input id="email" type="email" name="email">
  </fieldset>
</form>
# Raises error with rack driver (selenium + chrome handles correctly)
page.find_field 'Email', disabled: true

All 5 comments

Thanks for this report. Clear, understandable, all relevant info, and a way to reproduce - perfect :) PR #1817 should fix it, just waiting for the tests to pass.

Fixed via PR #1817 - It will be in the next release

Thank you for the kind words @twalpole, its the least I could do as a longtime user of Capybara, - and thank you even more for the fix.

I've realized my reproduction case above is incomplete, it doesn't cover ancestor fieldsets that aren't direct parents. I'm unsure if the changes at https://github.com/teamcapybara/capybara/pull/1817/files#diff-7064352df631f346ca44fb93af7af952R96 will cover this scenario:

<fieldset disabled="disabled">
  <div>
    <div>
      <input name="form[disabled_fieldset_nested_descendant]" id="form_disabled_fieldset_nested_descendant"/>
    </div>
  </div>
</fieldset>

I believe it should cover that scenario But will confirm tomorrow

I added a test to make sure it works with nested.

Was this page helpful?
0 / 5 - 0 ratings