Skip to content

Commit d45db68

Browse files
authored
Merge pull request #696 from SolidOS/profileEditA11y
fix date entry issue
2 parents f2c288b + 91a1254 commit d45db68

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

src/tabs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export function tabWidget (options: TabWidgetOptions) {
178178
const onClose = options.onClose
179179

180180
const [selectedColor, color] = getColors(backgroundColor)
181-
const bodyMainStyle = `flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ${selectedColor}; padding: 1em;`
181+
const bodyMainStyle = `display: grid; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ${selectedColor}; padding: 1em;`
182182
const rootElement: TabWidgetElement = dom.createElement('div') // 20200117a
183183

184184
rootElement.setAttribute('style', style.tabsRootElement)

src/widgets/forms.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,16 +712,40 @@ field[ns.ui('Classifier').uri] = function (
712712
if (!ok) return callbackFunction(ok, body)
713713
return callbackFunction(ok, body)
714714
}
715-
const box = makeSelectForNestedCategory(
715+
// Create container for label and select
716+
const outerBox = dom.createElement('div')
717+
outerBox.setAttribute('class', 'classifierBox')
718+
// Render label
719+
const labelDiv = dom.createElement('div')
720+
labelDiv.setAttribute('class', 'formFieldName classifierBox-label')
721+
// Use fieldLabel to render ui:label if present
722+
labelDiv.appendChild(fieldLabel(dom, category, form))
723+
outerBox.appendChild(labelDiv)
724+
// Render select
725+
const selectBox = dom.createElement('div')
726+
selectBox.setAttribute('class', 'formFieldValue classifierBox-selectBox')
727+
const selectElement = makeSelectForNestedCategory(
716728
dom,
717729
kb,
718730
subject,
719731
category,
720732
dataDoc,
721733
checkOptions
722734
)
723-
if (container) container.appendChild(box)
724-
return box
735+
// Set readonly if not editable
736+
if (selectElement && selectElement.querySelectorAll) {
737+
const selects = selectElement.querySelectorAll('select')
738+
if (selects.length && !kb.updater.editable(dataDoc.uri)) {
739+
selects.forEach(select => {
740+
select.readOnly = true
741+
select.style = style.textInputStyleUneditable
742+
})
743+
}
744+
}
745+
selectBox.appendChild(selectElement)
746+
outerBox.appendChild(selectBox)
747+
if (container) container.appendChild(outerBox)
748+
return outerBox
725749
}
726750

727751
/** Choice field

test/unit/__snapshots__/tabs.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports[`tabWidget minimal setup of options renders content for first tab 1`] =
88
style="height: 100%; width: 100%;"
99
>
1010
<main
11-
style="flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: #e7e7db; padding: 1em;"
11+
style="display: grid; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: #e7e7db; padding: 1em;"
1212
/>
1313
</div>
1414
<div

0 commit comments

Comments
 (0)