Skip to content
Snippets Groups Projects
Commit cea74f15 authored by Elmar Ludwig's avatar Elmar Ludwig Committed by David Siegfried
Browse files

stop overriding the button focus outline, fixes #1304

Closes #1304

Merge request studip/studip!800
parent b6f711b6
No related branches found
No related tags found
No related merge requests found
Pipeline #5168 passed
...@@ -36,12 +36,7 @@ class LinkButton extends Interactable ...@@ -36,12 +36,7 @@ class LinkButton extends Interactable
public function __toString() public function __toString()
{ {
// add "button" to attribute @class // add "button" to attribute @class
@$this->attributes["class"] .= " button"; $this->attributes['class'] .= ' button';
// add tabindex of zero to make buttons accesible when tabbing
if (!isset($this->attributes['tabindex'])) {
$this->attributes['tabindex'] = '0';
}
$attributes = []; $attributes = [];
ksort($this->attributes); ksort($this->attributes);
......
...@@ -24,13 +24,6 @@ ...@@ -24,13 +24,6 @@
&:hover, &:active { &:hover, &:active {
background: @base-color; background: @base-color;
color: white; color: white;
outline: 0;
}
&:focus {
outline: dotted 1px #000;
}
&::-moz-focus-inner {
border: 0;
} }
&.disabled, &[disabled] { &.disabled, &[disabled] {
......
...@@ -26,13 +26,6 @@ ...@@ -26,13 +26,6 @@
&:active { &:active {
background: $base-color; background: $base-color;
color: white; color: white;
outline: 0;
}
&:focus {
outline: dotted 1px #000;
}
&::-moz-focus-inner {
border: 0;
} }
&.disabled, &.disabled,
......
...@@ -20,49 +20,49 @@ class LinkButtonTestCase extends \Codeception\Test\Unit ...@@ -20,49 +20,49 @@ class LinkButtonTestCase extends \Codeception\Test\Unit
function testCreateWithLabel() function testCreateWithLabel()
{ {
$this->assertEquals('<a class="button" href="?" tabindex="0">yes</a>', $this->assertEquals('<a class="button" href="?">yes</a>',
'' . LinkButton::create('yes')); '' . LinkButton::create('yes'));
} }
function testCreateWithLabelAndUrl() 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')); '' . LinkButton::create('yes', 'http://example.net'));
} }
function testCreateWithLabelAndArray() 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])); '' . LinkButton::create('yes', ['a' => 1, 'b' => 2]));
} }
function testCreateWithLabelUrlAndArray() 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])); '' . LinkButton::create('yes', 'http://example.net', ['a' => 1, 'b' => 2]));
} }
function testCreateAccept() 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()); '' . LinkButton::createAccept());
} }
function testCreateCancel() 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()); '' . LinkButton::createCancel());
} }
function testCreatePreOrder() 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()); '' . LinkButton::createPreOrder());
} }
function testCreateWithInsaneArguments() function testCreateWithInsaneArguments()
{ {
$this->assertEquals('<a class="button" href="http://example.net?m=&amp;m=" mad="&lt;S&gt;tu&quot;ff" tabindex="0">&gt;ok&lt;</a>', $this->assertEquals('<a class="button" href="http://example.net?m=&amp;m=" mad="&lt;S&gt;tu&quot;ff">&gt;ok&lt;</a>',
'' . LinkButton::create('>ok<', 'http://example.net?m=&m=', ['mad' => '<S>tu"ff'])); '' . LinkButton::create('>ok<', 'http://example.net?m=&m=', ['mad' => '<S>tu"ff']));
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment