merged branch bschussek/issue8526 (PR #8622)
This PR was merged into the 2.2 branch.
Discussion
----------
[Form] Removed the "disabled" attribute from the placeholder option in select fields due to problems with the BlackBerry 10 browser
| Q | A
| ------------- | ---
| Bug fix? | yes (together with #8623)
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #7678 #8478 #8526
| License | MIT
| Doc PR | -
Commits
-------
97cbb19
[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:
commit
e82a44ba99
@ -69,7 +69,7 @@
|
|||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
|
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
|
||||||
{% if empty_value is not none %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% if preferred_choices|length > 0 %}
|
{% if preferred_choices|length > 0 %}
|
||||||
{% set options = preferred_choices %}
|
{% set options = preferred_choices %}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<?php echo $view['form']->block($form, 'widget_attributes') ?>
|
<?php echo $view['form']->block($form, 'widget_attributes') ?>
|
||||||
<?php if ($multiple): ?> multiple="multiple"<?php endif ?>
|
<?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 if (count($preferred_choices) > 0): ?>
|
||||||
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?>
|
<?php echo $view['form']->block($form, 'choice_widget_options', array('choices' => $preferred_choices)) ?>
|
||||||
<?php if (count($choices) > 0 && null !== $separator): ?>
|
<?php if (count($choices) > 0 && null !== $separator): ?>
|
||||||
|
@ -543,12 +543,15 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
'empty_value' => 'Test&Me'
|
'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(),
|
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||||
'/select
|
'/select
|
||||||
[@name="name"]
|
[@name="name"]
|
||||||
[@required="required"]
|
[@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="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
|
||||||
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
|
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
|
||||||
]
|
]
|
||||||
@ -566,12 +569,15 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
'expanded' => false,
|
'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' => ''),
|
$this->assertWidgetMatchesXpath($form->createView(), array('empty_value' => ''),
|
||||||
'/select
|
'/select
|
||||||
[@name="name"]
|
[@name="name"]
|
||||||
[@required="required"]
|
[@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="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
|
||||||
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
|
/following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
|
||||||
]
|
]
|
||||||
|
Reference in New Issue
Block a user