Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add labels to textarea elements in translate modal #5234

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

luka-nextcloud
Copy link
Contributor

@luka-nextcloud luka-nextcloud commented Jan 11, 2024

๐Ÿ“ Summary

๐Ÿ–ผ๏ธ Screenshots

๐Ÿš๏ธ Before ๐Ÿก After
image image

๐Ÿšง TODO

  • ...

๐Ÿ Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

@luka-nextcloud luka-nextcloud self-assigned this Jan 11, 2024
@luka-nextcloud luka-nextcloud added enhancement New feature or request 3. to review labels Jan 11, 2024
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

The autosize method seems to be broken due to that, you can check that by trying to type something in the input.

We probably can drop it and instead use resize from the component https://nextcloud-vue-components.netlify.app/#/Components/NcFields?id=nctextarea just need to ensure that the max height is limited to not exceed the visible screen space in the modal

Screenshot 2024-01-11 at 14 10 58

@juliusknorr juliusknorr added this to the Nextcloud 29 milestone Jan 11, 2024
@luka-nextcloud luka-nextcloud force-pushed the feature/add-labels-to-translate-textarea branch from 5c1b783 to 67c2d3c Compare January 15, 2024 15:57
@luka-nextcloud luka-nextcloud force-pushed the feature/add-labels-to-translate-textarea branch from 67c2d3c to a776275 Compare January 15, 2024 15:59
@juliusknorr juliusknorr force-pushed the feature/add-labels-to-translate-textarea branch from a776275 to ba0adf3 Compare January 16, 2024 07:57
@emoral435
Copy link

Since this issue deals with accessibility, would you want the rest of the accessibility team to also help review? :)

@juliusknorr
Copy link
Member

@emoral435 Definitely, additional reviews are very welcome

@juliusknorr juliusknorr requested a review from emoral435 January 22, 2024 08:29
Copy link

@emoral435 emoral435 left a comment

Choose a reason for hiding this comment

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

Other than these general questions, LGTM! Will ping other, more experiences a11y team members too :)

@@ -210,7 +225,7 @@ export default {
}
</script>

<style lang="scss" scoped>
<style lang="scss">

Choose a reason for hiding this comment

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

question: Any reason you removed this CSS being scoped? Just for best practices, I know this is only a text modal, but keeping it scoped will help ensure nothing funky happens in case there are similar classes

Choose a reason for hiding this comment

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

especially if you are adding the !important elements in the CSS, this indicates that other pieces of css that may not be scoped are affecting this code block, then having this be scoped helps prevent similar things in the future

@emoral435 emoral435 requested review from Pytal and ShGKme January 22, 2024 19:28
Copy link
Contributor

@ShGKme ShGKme left a comment

Choose a reason for hiding this comment

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

Agree with @emoral435, scoped should not be removed. These styles are not about something really global.

You can use :deep: https://vuejs.org/api/sfc-css-features.html#deep-selectors

Best to specify a selector on this component and then with deep selector on manually provided class.

.translate-dialog :deep(.translate-textarea)

/* or more specific, set class on the NcTextarea and then select on textarea */

.translate-dialog__textarea :deep(.translate-textarea)

@luka-nextcloud luka-nextcloud force-pushed the feature/add-labels-to-translate-textarea branch from ba0adf3 to 7eebe32 Compare January 23, 2024 18:51
@luka-nextcloud luka-nextcloud requested a review from ShGKme January 23, 2024 18:51
Comment on lines 38 to 43
<NcTextArea ref="input"
v-model="inputValue"
:label="t('text', 'Text to translate from')"
autofocus
@input="autosize"
input-class="translate-textarea"
resize="none"
Copy link
Contributor

Choose a reason for hiding this comment

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

It works, but it is incorrect usage of the component. NcTextArea, same as other fields in @nextcloud/vue, doesn't have v-model - it has no defined model and doesn't emit input event.

It works, because here v-model directive catches native event input that bubbles with the native event. What it why it was needed to add computed proxy.

Instead, .sync modifier should be used on value binding: :value.sync="input".

Comment on lines 128 to 136
inputValue: {
get() {
return this.input
},
set(event) {
this.input = event.target.value
this.autosize()
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to resize on input, we can watch the input property, so it won't be important how the value has changed for the resize.

@ShGKme
Copy link
Contributor

ShGKme commented Jan 24, 2024

Also, I cannot focus any input in the modal, but I cannot say if it isn't an issue on my side...

@luka-nextcloud
Copy link
Contributor Author

Also, I cannot focus any input in the modal, but I cannot say if it isn't an issue on my side...

Sorry, I cannot reproduce the issue on my side.

Signed-off-by: Luka Trovic <luka@nextcloud.com>
@luka-nextcloud luka-nextcloud force-pushed the feature/add-labels-to-translate-textarea branch from 7eebe32 to d29c967 Compare January 25, 2024 18:12
@luka-nextcloud luka-nextcloud requested a review from ShGKme January 25, 2024 18:13
@emoral435
Copy link

With two reviews, should be good to merge now @luka-nextcloud ๐Ÿ‘

@juliusknorr juliusknorr merged commit fa5e61d into main Jan 26, 2024
53 checks passed
@juliusknorr juliusknorr deleted the feature/add-labels-to-translate-textarea branch January 26, 2024 16:11
@JuliaKirschenheuter
Copy link
Contributor

/backport to stable28

@emoral435
Copy link

/backport d29c967 to stable28

@juliusknorr
Copy link
Member

/backport to stable28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BITV]: missing labels on textaria inside of translate modal dialog
5 participants