From cb2f0310bf86ac78ecd8355626d15382309aa754 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Fri, 23 Mar 2018 17:45:27 +0100 Subject: Small fixes. --- src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt | 3 ++- src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt | 7 ++----- src/main/kotlin/pl/treksoft/kvision/html/Div.kt | 3 +++ src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt | 6 +----- src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt | 6 +----- 5 files changed, 9 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt index 8a37cf6c..0a61a814 100644 --- a/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt +++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/DropDown.kt @@ -261,6 +261,7 @@ internal class DropDownButton( init { this.id = id + this.role = "button" setInternalEventListener { click = { e -> if (parent?.parent is ContextMenu) e.asDynamic().dropDownCM = true @@ -291,7 +292,7 @@ internal class DropDownButton( override fun getSnAttrs(): List { return super.getSnAttrs() + listOf( "data-toggle" to "dropdown", "aria-haspopup" to "true", - "aria-expanded" to "false", "role" to "button", "href" to "#" + "aria-expanded" to "false", "href" to "#" ) } } diff --git a/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt b/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt index e786b47a..f417ff84 100644 --- a/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt +++ b/src/main/kotlin/pl/treksoft/kvision/dropdown/Separator.kt @@ -3,7 +3,6 @@ */ package pl.treksoft.kvision.dropdown -import pl.treksoft.kvision.core.StringPair import pl.treksoft.kvision.html.ListTag import pl.treksoft.kvision.html.TAG import pl.treksoft.kvision.html.Tag @@ -16,10 +15,8 @@ import pl.treksoft.kvision.html.Tag */ open class Separator(classes: Set = setOf()) : Tag(TAG.LI, classes = classes + "divider") { - override fun getSnAttrs(): List { - val pr = super.getSnAttrs().toMutableList() - pr.add("role" to "separator") - return pr + init { + role = "separator" } companion object { diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Div.kt b/src/main/kotlin/pl/treksoft/kvision/html/Div.kt index 6d8e05ef..6acc9d5b 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Div.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Div.kt @@ -29,6 +29,9 @@ import pl.treksoft.kvision.core.Container * @constructor * @param content element text * @param rich determines if [content] can contain HTML code + * @param align content align + * @param classes a set of CSS class names + * @param init an initializer extension function */ open class Div( content: String, diff --git a/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt b/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt index ddb3bca4..bf1cdc43 100644 --- a/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt +++ b/src/main/kotlin/pl/treksoft/kvision/toolbar/ButtonGroup.kt @@ -5,7 +5,6 @@ package pl.treksoft.kvision.toolbar import pl.treksoft.kvision.core.Container import pl.treksoft.kvision.core.StringBoolPair -import pl.treksoft.kvision.core.StringPair import pl.treksoft.kvision.panel.SimplePanel /** @@ -49,6 +48,7 @@ open class ButtonGroup( var style by refreshOnUpdate(style) init { + role = "group" @Suppress("LeakingThis") init?.invoke(this) } @@ -67,10 +67,6 @@ open class ButtonGroup( return cl } - override fun getSnAttrs(): List { - return super.getSnAttrs() + ("role" to "group") - } - companion object { /** * DSL builder extension function. diff --git a/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt b/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt index a1651a22..9e2de7f3 100644 --- a/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt +++ b/src/main/kotlin/pl/treksoft/kvision/toolbar/Toolbar.kt @@ -4,7 +4,6 @@ package pl.treksoft.kvision.toolbar import pl.treksoft.kvision.core.Container -import pl.treksoft.kvision.core.StringPair import pl.treksoft.kvision.panel.SimplePanel /** @@ -19,14 +18,11 @@ open class Toolbar( ) : SimplePanel(classes + "btn-toolbar") { init { + role = "toolbar" @Suppress("LeakingThis") init?.invoke(this) } - override fun getSnAttrs(): List { - return super.getSnAttrs() + ("role" to "toolbar") - } - companion object { /** * DSL builder extension function. -- cgit