aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-12-06 11:00:21 +0100
committerRobert Jaros <rjaros@finn.pl>2019-12-06 11:00:21 +0100
commit3996f23302bb2584270a4a494f8d5886d05a19cb (patch)
tree0342e4a9672c62c31bd2d57cdd5b40ce64c5ec3f
parente24f48420d1ee9a8684d8ccfa6d01d7e7036f5ee (diff)
downloadkvision-3996f23302bb2584270a4a494f8d5886d05a19cb.tar.gz
kvision-3996f23302bb2584270a4a494f8d5886d05a19cb.tar.bz2
kvision-3996f23302bb2584270a4a494f8d5886d05a19cb.zip
Focus the default buttons in Alert and Confirm dialogs
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Alert.kt3
-rw-r--r--kvision-modules/kvision-bootstrap/src/main/kotlin/pl/treksoft/kvision/modal/Confirm.kt6
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() {