Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 45 additions & 7 deletions src/components/RightSidebar/Participants/ParticipantsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@
:value.sync="searchText"
:is-focused.sync="isFocused"
:placeholder-text="searchBoxPlaceholder"
:aria-describedby="showSearchBoxDescription && searchBoxDescriptionId"
@input="handleInput"
@keydown.enter="addParticipants(participantPhoneItem)"
@abort-search="abortSearch" />
<div v-if="showSearchBoxDescription"
:id="searchBoxDescriptionId"
:title="searchBoxDescription"
class="search-form__description">
<IconInformationOutline :size="20" />
<span class="hidden-visually">{{ searchBoxDescription }}</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't aria-label be sufficient here? If not, I'm afraid, we might accidentally delete it in future, if it won't be specifically commented

Copy link
Contributor Author

@ShGKme ShGKme Aug 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-label is only valid on elements discoverable via assistive technologies:

  • An interactive element such as buttons
  • lists, modals, navigation and other landmarks

In other cases, it must be a general text content

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative is to remove the text here and set it as aria-desription on the input. But then I'm afraid it's even simpler to lose, because it would have no direct relation with the element.

</div>
<DialpadPanel v-if="canAddPhones"
:value.sync="searchText"
@submit="addParticipants(participantPhoneItem)" />
Expand Down Expand Up @@ -55,8 +63,11 @@
import debounce from 'debounce'
import { ref, toRefs } from 'vue'

import IconInformationOutline from 'vue-material-design-icons/InformationOutline.vue'

import { showError } from '@nextcloud/dialogs'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { loadState } from '@nextcloud/initial-state'
import { t } from '@nextcloud/l10n'

import NcAppNavigationCaption from '@nextcloud/vue/dist/Components/NcAppNavigationCaption.js'
Expand All @@ -71,6 +82,7 @@ import SearchBox from '../../UIShared/SearchBox.vue'

import { useArrowNavigation } from '../../../composables/useArrowNavigation.js'
import { useGetParticipants } from '../../../composables/useGetParticipants.js'
import { useId } from '../../../composables/useId.ts'
import { useIsInCall } from '../../../composables/useIsInCall.js'
import { useSortParticipants } from '../../../composables/useSortParticipants.js'
import { ATTENDEE } from '../../../constants.js'
Expand All @@ -80,6 +92,8 @@ import { EventBus } from '../../../services/EventBus.js'
import { addParticipant } from '../../../services/participantsService.js'
import CancelableRequest from '../../../utils/cancelableRequest.js'

const isFederationEnabled = loadState('spreed', 'federation_enabled')

export default {
name: 'ParticipantsTab',
components: {
Expand All @@ -91,6 +105,7 @@ export default {
ParticipantsSearchResults,
SearchBox,
SelectPhoneNumber,
IconInformationOutline,
},

props: {
Expand Down Expand Up @@ -118,7 +133,12 @@ export default {

const { initializeNavigation, resetNavigation } = useArrowNavigation(wrapper, searchBox)

const searchBoxDescriptionId = `search-box-description-${useId()}`
const searchBoxDescription = t('spreed', 'You can search or add participants via name, email, or Federated Cloud ID')

return {
searchBoxDescriptionId,
searchBoxDescription,
initializeNavigation,
resetNavigation,
wrapper,
Expand Down Expand Up @@ -164,6 +184,11 @@ export default {
? t('spreed', 'Search or add participants')
: t('spreed', 'Search participants')
},

showSearchBoxDescription() {
return isFederationEnabled && this.canAdd
},

show() {
return this.$store.getters.getSidebarStatus
},
Expand Down Expand Up @@ -343,13 +368,26 @@ export default {
}

.search-form {
display: flex;
align-items: center;
gap: 4px;

.search-form__input {
margin: 0;
}
display: flex;
align-items: center;
gap: 4px;

.search-form__input {
margin: 0;
}

&__description {
width: var(--default-clickable-area);
height: var(--default-clickable-area);
display: flex;
align-items: center;
justify-content: center;

&,
& > :deep(*) {
cursor: help;
}
}
}

.scroller {
Expand Down
9 changes: 9 additions & 0 deletions src/components/UIShared/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<NcTextField ref="searchConversations"
:value="value"
:aria-label="placeholderText"
:aria-describedby="ariaDescribedby"
:placeholder="placeholderText"
:show-trailing-button="isFocused"
class="search-box"
Expand Down Expand Up @@ -62,6 +63,14 @@ export default {
type: Object,
default: null,
},

/**
* Input's aria-describedby attribute
*/
ariaDescribedby: {
type: String,
default: undefined,
},
},

expose: ['focus'],
Expand Down