Skip to content

Commit

Permalink
fix(a11y): provide accessible heading to NewConversationDialog
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Aug 16, 2024
1 parent de5f18c commit 96efc86
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions src/components/NewConversationDialog/NewConversationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
class="new-group-conversation"
:close-on-click-outside="!isFilled"
:container="container"
:label-id="dialogHeaderPrepId"
@close="closeModal">
<h2 class="new-group-conversation__header">
<h2 :id="dialogHeaderPrepId" class="new-group-conversation__header">
{{ t('spreed', 'Create a new group conversation') }}
</h2>

Expand Down Expand Up @@ -69,6 +70,7 @@
<!-- Third page : this is the confirmation page-->
<NcModal v-if="page === 2"
:container="container"
:label-id="dialogHeaderResId"
@close="closeModal">
<NcEmptyContent>
<template #icon>
Expand All @@ -78,15 +80,7 @@
</template>

<template #description>
<p v-if="isLoading">
{{ t('spreed', 'Creating the conversation …') }}
</p>
<p v-else-if="error">
{{ t('spreed', 'Error while creating the conversation') }}
</p>
<p v-else-if="success && isPublic">
{{ t('spreed', 'All set, the conversation "{conversationName}" was created.', { conversationName }) }}
</p>
<p :id="dialogHeaderResId">{{ creatingConversationDescription }}</p>

Check warning on line 83 in src/components/NewConversationDialog/NewConversationDialog.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected 1 line break after opening tag (`<p>`), but no line breaks found

Check warning on line 83 in src/components/NewConversationDialog/NewConversationDialog.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Expected 1 line break before closing tag (`</p>`), but no line breaks found
</template>

<template #action>
Expand Down Expand Up @@ -115,7 +109,6 @@ import { provide, ref } from 'vue'
import AlertCircle from 'vue-material-design-icons/AlertCircle.vue'
import Check from 'vue-material-design-icons/Check.vue'
import { showError } from '@nextcloud/dialogs'
import { t } from '@nextcloud/l10n'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
Expand All @@ -126,6 +119,7 @@ import NewConversationContactsPage from './NewConversationContactsPage.vue'
import NewConversationSetupPage from './NewConversationSetupPage.vue'
import LoadingComponent from '../LoadingComponent.vue'
import { useId } from '../../composables/useId.ts'
import { useIsInCall } from '../../composables/useIsInCall.js'
import { CONVERSATION } from '../../constants.js'
import { setConversationPassword } from '../../services/conversationsService.js'
Expand Down Expand Up @@ -170,9 +164,14 @@ export default {
// Add a visual bulk selection state for Participant component
provide('bulkParticipantsSelection', true)
const dialogHeaderPrepId = `new-conversation-prepare-${useId()}`
const dialogHeaderResId = `new-conversation-result-${useId()}`
return {
isInCall,
selectedParticipants,
dialogHeaderPrepId,
dialogHeaderResId,
}
},
Expand Down Expand Up @@ -214,6 +213,17 @@ export default {
return JSON.stringify(this.newConversation) !== JSON.stringify(NEW_CONVERSATION)
|| this.listable !== CONVERSATION.LISTABLE.NONE || this.isAvatarEdited
},
creatingConversationDescription() {
if (this.isLoading) {
return t('spreed', 'Creating the conversation …')
} else if (this.error) {
return t('spreed', 'Error while creating the conversation')
} else if (this.success && this.isPublic) {
return t('spreed', 'All set, the conversation "{conversationName}" was created.', { conversationName: this.conversationName })
}
return ''
}
},
watch: {
Expand Down

0 comments on commit 96efc86

Please sign in to comment.