diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-12-02 10:04:40 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-12-02 10:04:40 +0100 |
commit | 919d4e62b8e464e4babd76f6fd13c944daee3af6 (patch) | |
tree | a869f062e65c9bec7b33dca4ebc59db8857e709b | |
parent | 1cb9cc8ff1378171280f07f8143145d78e61dab4 (diff) | |
download | kvision-919d4e62b8e464e4babd76f6fd13c944daee3af6.tar.gz kvision-919d4e62b8e464e4babd76f6fd13c944daee3af6.tar.bz2 kvision-919d4e62b8e464e4babd76f6fd13c944daee3af6.zip |
Fix keyboard and focus handling for UploadInput component
-rw-r--r-- | kvision-modules/kvision-bootstrap-upload/src/main/kotlin/pl/treksoft/kvision/form/upload/UploadInput.kt | 10 | ||||
-rw-r--r-- | src/main/resources/css/style.css | 10 |
2 files changed, 20 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() { diff --git a/src/main/resources/css/style.css b/src/main/resources/css/style.css index 4adc61c0..a6035b1d 100644 --- a/src/main/resources/css/style.css +++ b/src/main/resources/css/style.css @@ -387,3 +387,13 @@ select.form-control, .tabulator-row .tabulator-cell.tabulator-editing select { border-radius: 0 4px 4px 0; margin-right: 0; } + +.kv-focus { + border-radius: 0.25rem; + outline-width: 0px; + box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25); +} + +.kv-focus .kv-fileinput-caption { + border-color: #80bdff; +} |