Skip to content

Commit bf609c2

Browse files
authored
feat(QScrollArea): allow scrolling element to be focusable quasarframework#8893 (quasarframework#8896)
quasarframework#8893
1 parent 68f8d80 commit bf609c2

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

ui/dev/src/pages/components/scroll-area.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<q-toggle v-model="customStyle" label="Custom style" />
55
<q-toggle v-model="alwaysVisible" toggle-indeterminate label="Always visible" />
66
<q-toggle v-model="darkVariant" toggle-indeterminate label="Dark variant" />
7+
<q-toggle v-model="focusable" label="Focusable" />
78

89
<div style="height: 300px;" />
910

@@ -16,6 +17,7 @@
1617
:visible="alwaysVisible"
1718
:bar-style="customStyle === true ? customBarStyle : void 0"
1819
:thumb-style="customStyle === true ? customThumbStyle : void 0"
20+
:tabindex="focusable === true ? 0 : void 0"
1921
>
2022
<div :class="{ 'flex no-wrap' : horizontal }">
2123
<div style="margin-top: 150px" />
@@ -34,6 +36,7 @@
3436
:horizontal="horizontal"
3537
:visible="alwaysVisible"
3638
dark
39+
:tabindex="focusable === true ? 0 : void 0"
3740
>
3841
<div :class="{ 'flex no-wrap' : horizontal }">
3942
<div style="margin-top: 150px" />
@@ -73,7 +76,8 @@ export default {
7376
number: 10,
7477
horizontal: false,
7578
alwaysVisible: true,
76-
customStyle: true
79+
customStyle: true,
80+
focusable: true
7781
}
7882
},
7983

ui/src/components/scroll-area/QScrollArea.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export default Vue.extend({
3737
default: null
3838
},
3939

40-
horizontal: Boolean
40+
horizontal: Boolean,
41+
42+
tabindex: [String, Number]
4143
},
4244

4345
data () {
@@ -138,6 +140,12 @@ export default Vue.extend({
138140
},
139141
value: this.__panThumb
140142
}]
143+
},
144+
145+
scrollAttrs () {
146+
if (this.tabindex !== void 0) {
147+
return { tabindex: this.tabindex }
148+
}
141149
}
142150
},
143151

@@ -267,7 +275,8 @@ export default Vue.extend({
267275
}, [
268276
h('div', {
269277
ref: 'target',
270-
staticClass: 'scroll relative-position fit hide-scrollbar'
278+
staticClass: 'scroll relative-position fit hide-scrollbar',
279+
attrs: this.scrollAttrs
271280
}, [
272281
h('div', {
273282
staticClass: 'absolute',

ui/src/components/scroll-area/QScrollArea.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
"type": "Boolean",
5858
"desc": "Register for horizontal scroll instead of vertical (which is default)",
5959
"category": "behavior"
60+
},
61+
62+
"tabindex": {
63+
"extends": "tabindex"
6064
}
6165
},
6266

0 commit comments

Comments
 (0)