[Form] Removed the "disabled" attribute from the placeholder option in select fields due to problems with the BlackBerry 10 browser
This commit is contained in:
parent
b970d172cb
commit
97cbb19bce
@ -69,7 +69,7 @@
|
||||
{% spaceless %}
|
||||
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
|
||||
{% if empty_value is not none %}
|
||||
<option value=""{% if required %} disabled="disabled"{% if value is empty %} selected="selected"{% endif %}{% endif %}>{{ empty_value|trans({}, translation_domain) }}</option>
|
||||
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ empty_value|trans({}, translation_domain) }}</option>
|
||||
{% endif %}
|
||||
{% if preferred_choices|length > 0 %}
|
||||
{% set options = preferred_choices %}
|
||||
|
@ -2,7 +2,7 @@
|
||||
<?php echo $view['form']->block($form, 'widget_attributes') ?>
|
||||
<?php if ($multiple): ?> multiple="multiple"<?php endif ?>
|
||||
>
|
||||
<?php if (null !== $empty_value): ?><option value=""<?php if ($required):?> disabled="disabled"<?php if (empty($value) && "0" !== $value): ?> selected="selected"<?php endif ?><?php endif?>><?php echo $view->escape($view['translator']->trans($empty_value, array(), $translation_domain)) ?></option><?php endif; ?>
|
||||
<?php if (null !== $empty_value): ?><option value=""<?php if ($required and empty($value) && "0" !== $value): ?> selected="selected"<?php endif?>><?php echo $view->escape($view['translator']->trans($empty_value, array(), $translation_domain)) ?></option><?php endif; ?>
|
||||
<?php if (count($preferred_choices) > 0): ?>
|
||||
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?>
|
||||
<?php if (count($choices) > 0 && null !== $separator): ?>
|
||||
|
@ -543,12 +543,15 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
'empty_value' => 'Test&Me'
|
||||
));
|
||||
|
||||
// The "disabled" attribute was removed again due to a bug in the
|
||||
// BlackBerry 10 browser.
|
||||
// See https://github.com/symfony/symfony/pull/7678
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||
'/select
|
||||
[@name="name"]
|
||||
[@required="required"]
|
||||
[
|
||||
./option[@value=""][not(@selected)][@disabled][.="[trans]Test&Me[/trans]"]
|
||||
./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Test&Me[/trans]"]
|
||||
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
|
||||
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
|
||||
]
|
||||
@ -566,12 +569,15 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
||||
'expanded' => false,
|
||||
));
|
||||
|
||||
// The "disabled" attribute was removed again due to a bug in the
|
||||
// BlackBerry 10 browser.
|
||||
// See https://github.com/symfony/symfony/pull/7678
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array('empty_value' => ''),
|
||||
'/select
|
||||
[@name="name"]
|
||||
[@required="required"]
|
||||
[
|
||||
./option[@value=""][not(@selected)][@disabled][.="[trans][/trans]"]
|
||||
./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]
|
||||
/following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
|
||||
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
|
||||
]
|
||||
|
Reference in New Issue
Block a user