aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-bootstrap-upload/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-12-02 10:04:40 +0100
committerRobert Jaros <rjaros@finn.pl>2019-12-02 10:04:40 +0100
commit919d4e62b8e464e4babd76f6fd13c944daee3af6 (patch)
treea869f062e65c9bec7b33dca4ebc59db8857e709b /kvision-modules/kvision-bootstrap-upload/src/main
parent1cb9cc8ff1378171280f07f8143145d78e61dab4 (diff)
downloadkvision-919d4e62b8e464e4babd76f6fd13c944daee3af6.tar.gz
kvision-919d4e62b8e464e4babd76f6fd13c944daee3af6.tar.bz2
kvision-919d4e62b8e464e4babd76f6fd13c944daee3af6.zip
Fix keyboard and focus handling for UploadInput component
Diffstat (limited to 'kvision-modules/kvision-bootstrap-upload/src/main')
-rw-r--r--kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt10
1 files changed, 10 insertions, 0 deletions
diff --git a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
index 932bd444..ecdbf1b8 100644
--- a/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
+++ b/kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt
@@ -181,6 +181,10 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
@Suppress("UnsafeCastFromDynamic")
override fun afterInsert(node: VNode) {
getElementJQueryD()?.fileinput(getSettingsObj())
+ getElementJQuery()?.parent()?.parent()?.parent()?.find("div.kv-fileinput-caption")?.removeAttr("tabindex")
+ getElementJQuery()?.parent()?.parent()?.parent()?.find("input.file-caption-name")?.attr("tabindex", "-1")
+ getElementJQuery()?.parent()?.parent()?.parent()?.find("button.fileinput-remove")?.removeAttr("tabindex")
+ getElementJQuery()?.parent()?.parent()?.parent()?.find("div.btn-file")?.removeAttr("tabindex")
if (uploadUrl != null) {
this.getElementJQuery()?.on("fileselect") { e, _ ->
this.dispatchEvent("fileSelectUpload", obj { detail = e })
@@ -201,6 +205,12 @@ open class UploadInput(uploadUrl: String? = null, multiple: Boolean = false, cla
return@lambda null
}
}
+ this.getElementJQuery()?.on("focus") { _, _ ->
+ getElementJQuery()?.parent()?.parent()?.parent()?.addClass("kv-focus")
+ }
+ this.getElementJQuery()?.on("blur") { _, _ ->
+ getElementJQuery()?.parent()?.parent()?.parent()?.removeClass("kv-focus")
+ }
}
override fun afterDestroy() {