diff --git a/l10n/messages.pot b/l10n/messages.pot index 9e1c2b52e6..da0ef21167 100644 --- a/l10n/messages.pot +++ b/l10n/messages.pot @@ -191,6 +191,10 @@ msgstr "" msgid "Load more \"{options}\"" msgstr "" +#. TRANSLATORS: The button is in a loading state +msgid "Loading …" +msgstr "" + #. TRANSLATORS: A color name for RGB(45, 115, 190) msgid "Mariner" msgstr "" diff --git a/src/components/NcDialog/NcDialog.vue b/src/components/NcDialog/NcDialog.vue index 53bc6d6c86..c129748fd7 100644 --- a/src/components/NcDialog/NcDialog.vue +++ b/src/components/NcDialog/NcDialog.vue @@ -106,7 +106,6 @@ Note that this is not possible if the dialog contains a navigation! ``` + +### Loading buttons +Sometimes a dialog ends with a request and this request might fail due to server-side-validation. +In this case it is often desired to keep the dialog open, this can be done by returning `false` from the button callback, +to not block this callback should return a `Promise`. + +It is also possible to get the result of the callback from the dialog, as the result is passed as the payload of the `closing` event. + +While the promise is awaited the button will have a loading state, +this means, as long as no custom `icon`-slot is used, a loading icon will be shown. +Please note that the **button will not be disabled or accessibility reasons**, +because disabled elements cannot be focused and so the loading state could not be communicated e.g. via screen readers. + +```vue + + +``` - diff --git a/styleguide.config.cjs b/styleguide.config.cjs index 981e528fb1..73e94f1550 100644 --- a/styleguide.config.cjs +++ b/styleguide.config.cjs @@ -66,6 +66,9 @@ module.exports = async () => { }, enhancePreviewApp: path.resolve(__dirname, 'styleguide/preview.js'), + compilerConfig: { + transforms: { asyncAwait: false }, + }, sections: [ {