From cea74f152c0211c157413a952af7c41c869e617e Mon Sep 17 00:00:00 2001 From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> Date: Tue, 12 Jul 2022 19:34:00 +0000 Subject: [PATCH] stop overriding the button focus outline, fixes #1304 Closes #1304 Merge request studip/studip!800 --- lib/classes/LinkButton.class.php | 7 +------ resources/assets/stylesheets/less/buttons.less | 7 ------- resources/assets/stylesheets/scss/buttons.scss | 7 ------- tests/unit/lib/classes/LinkButtonTest.php | 16 ++++++++-------- 4 files changed, 9 insertions(+), 28 deletions(-) diff --git a/lib/classes/LinkButton.class.php b/lib/classes/LinkButton.class.php index 26678622f8a..6d60da83b82 100644 --- a/lib/classes/LinkButton.class.php +++ b/lib/classes/LinkButton.class.php @@ -36,12 +36,7 @@ class LinkButton extends Interactable public function __toString() { // add "button" to attribute @class - @$this->attributes["class"] .= " button"; - - // add tabindex of zero to make buttons accesible when tabbing - if (!isset($this->attributes['tabindex'])) { - $this->attributes['tabindex'] = '0'; - } + $this->attributes['class'] .= ' button'; $attributes = []; ksort($this->attributes); diff --git a/resources/assets/stylesheets/less/buttons.less b/resources/assets/stylesheets/less/buttons.less index d2b840ff5fc..d11ac0ddf90 100644 --- a/resources/assets/stylesheets/less/buttons.less +++ b/resources/assets/stylesheets/less/buttons.less @@ -24,13 +24,6 @@ &:hover, &:active { background: @base-color; color: white; - outline: 0; - } - &:focus { - outline: dotted 1px #000; - } - &::-moz-focus-inner { - border: 0; } &.disabled, &[disabled] { diff --git a/resources/assets/stylesheets/scss/buttons.scss b/resources/assets/stylesheets/scss/buttons.scss index 5d86edd2ce8..3ffb84ca067 100644 --- a/resources/assets/stylesheets/scss/buttons.scss +++ b/resources/assets/stylesheets/scss/buttons.scss @@ -26,13 +26,6 @@ &:active { background: $base-color; color: white; - outline: 0; - } - &:focus { - outline: dotted 1px #000; - } - &::-moz-focus-inner { - border: 0; } &.disabled, diff --git a/tests/unit/lib/classes/LinkButtonTest.php b/tests/unit/lib/classes/LinkButtonTest.php index a0b8f1172d4..c83669bd1f4 100644 --- a/tests/unit/lib/classes/LinkButtonTest.php +++ b/tests/unit/lib/classes/LinkButtonTest.php @@ -20,49 +20,49 @@ class LinkButtonTestCase extends \Codeception\Test\Unit function testCreateWithLabel() { - $this->assertEquals('<a class="button" href="?" tabindex="0">yes</a>', + $this->assertEquals('<a class="button" href="?">yes</a>', '' . LinkButton::create('yes')); } function testCreateWithLabelAndUrl() { - $this->assertEquals('<a class="button" href="http://example.net" tabindex="0">yes</a>', + $this->assertEquals('<a class="button" href="http://example.net">yes</a>', '' . LinkButton::create('yes', 'http://example.net')); } function testCreateWithLabelAndArray() { - $this->assertEquals('<a a="1" b="2" class="button" href="?" tabindex="0">yes</a>', + $this->assertEquals('<a a="1" b="2" class="button" href="?">yes</a>', '' . LinkButton::create('yes', ['a' => 1, 'b' => 2])); } function testCreateWithLabelUrlAndArray() { - $this->assertEquals('<a a="1" b="2" class="button" href="http://example.net" tabindex="0">yes</a>', + $this->assertEquals('<a a="1" b="2" class="button" href="http://example.net">yes</a>', '' . LinkButton::create('yes', 'http://example.net', ['a' => 1, 'b' => 2])); } function testCreateAccept() { - $this->assertEquals('<a class="accept button" href="?" name="accept" tabindex="0">Ãœbernehmen</a>', + $this->assertEquals('<a class="accept button" href="?" name="accept">Ãœbernehmen</a>', '' . LinkButton::createAccept()); } function testCreateCancel() { - $this->assertEquals('<a class="cancel button" href="?" name="cancel" tabindex="0">Abbrechen</a>', + $this->assertEquals('<a class="cancel button" href="?" name="cancel">Abbrechen</a>', '' . LinkButton::createCancel()); } function testCreatePreOrder() { - $this->assertEquals('<a class="pre-order button" href="?" name="pre-order" tabindex="0">ok</a>', + $this->assertEquals('<a class="pre-order button" href="?" name="pre-order">ok</a>', '' . LinkButton::createPreOrder()); } function testCreateWithInsaneArguments() { - $this->assertEquals('<a class="button" href="http://example.net?m=&m=" mad="<S>tu"ff" tabindex="0">>ok<</a>', + $this->assertEquals('<a class="button" href="http://example.net?m=&m=" mad="<S>tu"ff">>ok<</a>', '' . LinkButton::create('>ok<', 'http://example.net?m=&m=', ['mad' => '<S>tu"ff'])); } } -- GitLab