Skip to content

Commit cc39a0a

Browse files
author
Eugene Tupikov
committed
#339 don't set tabindex explicitly
1 parent ec04946 commit cc39a0a

File tree

2 files changed

+16
-43
lines changed

2 files changed

+16
-43
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
Yii2 multiple input change log
22
==============================
33

4-
2.24.0 (in development)
4+
2.25.0 (in development)
55
=======================
66

7+
2.24.0
8+
======
9+
- #339 don't set tabindex explicitly
10+
711
2.23.0
812
======
913
- always use `id` from the settings if it is specified

src/components/BaseColumn.php

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ abstract class BaseColumn extends BaseObject
3939
const TYPE_RADIO = 'radio';
4040
const TYPE_DRAGCOLUMN = 'dragColumn';
4141

42-
const TABINDEX = 1;
43-
4442
const DEFAULT_STATIC_COLUMN_NAME = 'static-column';
4543

4644
/**
@@ -366,11 +364,7 @@ protected function renderDropDownList($name, $value, $options)
366364
if ($this->renderer->isBootstrapTheme()) {
367365
Html::addCssClass($options, 'form-control');
368366
}
369-
370-
if (!isset($options['tabindex'])) {
371-
$options['tabindex'] = self::TABINDEX;
372-
}
373-
367+
374368
return Html::dropDownList($name, $value, $this->prepareItems($this->items), $options);
375369
}
376370

@@ -402,11 +396,7 @@ protected function renderListBox($name, $value, $options)
402396
if ($this->renderer->isBootstrapTheme()) {
403397
Html::addCssClass($options, 'form-control');
404398
}
405-
406-
if (!isset($options['tabindex'])) {
407-
$options['tabindex'] = self::TABINDEX;
408-
}
409-
399+
410400
return Html::listBox($name, $value, $this->prepareItems($this->items), $options);
411401
}
412402

@@ -433,10 +423,6 @@ protected function renderHiddenInput($name, $value, $options)
433423
*/
434424
protected function renderRadio($name, $value, $options)
435425
{
436-
if (!isset($options['tabindex'])) {
437-
$options['tabindex'] = self::TABINDEX;
438-
}
439-
440426
if (!isset($options['label'])) {
441427
$options['label'] = '';
442428
}
@@ -460,10 +446,6 @@ protected function renderRadio($name, $value, $options)
460446
*/
461447
protected function renderRadioList($name, $value, $options)
462448
{
463-
if (!isset($options['tabindex'])) {
464-
$options['tabindex'] = self::TABINDEX;
465-
}
466-
467449
if (!array_key_exists('unselect', $options)) {
468450
$options['unselect'] = '';
469451
}
@@ -473,7 +455,6 @@ protected function renderRadioList($name, $value, $options)
473455
'label' => $label,
474456
'value' => $value,
475457
'data-id' => ArrayHelper::getValue($options, 'id'),
476-
'tabindex' => self::TABINDEX
477458
]);
478459

479460
return Html::tag('div', $content, ['class' => 'radio']);
@@ -494,10 +475,6 @@ protected function renderRadioList($name, $value, $options)
494475
*/
495476
protected function renderCheckbox($name, $value, $options)
496477
{
497-
if (!isset($options['tabindex'])) {
498-
$options['tabindex'] = self::TABINDEX;
499-
}
500-
501478
if (!isset($options['label'])) {
502479
$options['label'] = '';
503480
}
@@ -521,10 +498,6 @@ protected function renderCheckbox($name, $value, $options)
521498
*/
522499
protected function renderCheckboxList($name, $value, $options)
523500
{
524-
if (!isset($options['tabindex'])) {
525-
$options['tabindex'] = self::TABINDEX;
526-
}
527-
528501
if (!array_key_exists('unselect', $options)) {
529502
$options['unselect'] = '';
530503
}
@@ -534,7 +507,6 @@ protected function renderCheckboxList($name, $value, $options)
534507
'label' => $label,
535508
'value' => $value,
536509
'data-id' => ArrayHelper::getValue($options, 'id'),
537-
'tabindex' => self::TABINDEX
538510
]);
539511

540512
return Html::tag('div', $content, ['class' => 'checkbox']);
@@ -555,10 +527,6 @@ protected function renderCheckboxList($name, $value, $options)
555527
*/
556528
protected function renderStatic($name, $value, $options)
557529
{
558-
if (!isset($options['tabindex'])) {
559-
$options['tabindex'] = self::TABINDEX;
560-
}
561-
562530
if ($this->renderer->isBootstrapTheme()) {
563531
Html::addCssClass($options, 'form-control-static');
564532
}
@@ -604,10 +572,6 @@ protected function renderDefault($name, $value, $options)
604572
$type = $this->type;
605573

606574
if (method_exists('yii\helpers\Html', $type)) {
607-
if (!isset($options['tabindex'])) {
608-
$options['tabindex'] = self::TABINDEX;
609-
}
610-
611575
if ($this->renderer->isBootstrapTheme()) {
612576
Html::addCssClass($options, 'form-control');
613577
}
@@ -633,10 +597,15 @@ protected function renderDefault($name, $value, $options)
633597
*/
634598
protected function renderWidget($type, $name, $value, $options)
635599
{
636-
637-
$tabindex = isset($options['options']['tabindex']) ? $options['options']['tabindex'] : self::TABINDEX;
638-
unset($options['tabindex']);
639-
600+
if (isset($options['options']['tabindex'])) {
601+
$tabindex = $options['options']['tabindex'];
602+
} elseif (isset($options['tabindex'])) {
603+
$tabindex = $options['tabindex'];
604+
unset($options['tabindex']);
605+
} else {
606+
$tabindex = null;
607+
}
608+
640609
$id = isset($options['id']) ? $options['id'] : $this->normalize($name);
641610
$model = $this->getModel();
642611
if ($model instanceof Model) {

0 commit comments

Comments
 (0)