diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-12-06 11:00:21 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-12-06 11:00:21 +0100 |
commit | 3996f23302bb2584270a4a494f8d5886d05a19cb (patch) | |
tree | 0342e4a9672c62c31bd2d57cdd5b40ce64c5ec3f /kvision-modules/kvision-bootstrap | |
parent | e24f48420d1ee9a8684d8ccfa6d01d7e7036f5ee (diff) | |
download | kvision-3996f23302bb2584270a4a494f8d5886d05a19cb.tar.gz kvision-3996f23302bb2584270a4a494f8d5886d05a19cb.tar.bz2 kvision-3996f23302bb2584270a4a494f8d5886d05a19cb.zip |
Focus the default buttons in Alert and Confirm dialogs
Diffstat (limited to 'kvision-modules/kvision-bootstrap')
-rw-r--r-- | kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt | 3 | ||||
-rw-r--r-- | kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt index cfdd36a9..82babb8f 100644 --- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt +++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt @@ -90,6 +90,9 @@ open class Alert( hide() } } + shownBsModal = { + okButton.focus() + } } } diff --git a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt index 660c253c..5a97bf77 100644 --- a/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt +++ b/kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt @@ -21,6 +21,7 @@ */ package pl.treksoft.kvision.modal +import pl.treksoft.kvision.core.onEvent import pl.treksoft.kvision.html.Align import pl.treksoft.kvision.html.Button import pl.treksoft.kvision.html.ButtonStyle @@ -136,6 +137,11 @@ open class Confirm( } this.addButton(yesButton) refreshCancelButton() + onEvent { + shownBsModal = { + yesButton.focus() + } + } } private fun refreshCancelButton() { |