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

add KFocusTrap and use it in Kmodal #764

Closed
wants to merge 13 commits into from

Conversation

lokesh-sagi125
Copy link
Contributor

Description

copied the focus trap form 'kolibri' and created a new component "KFocusTrap" in the KDS and wrapper 'Kmodal' with it.

Issue addressed

Add KfocusTrap and use it Kmodal

Addresses #746

Changelog

  • Description: added KFocusTrap component to the kds and use it in Kmodal
  • Products impact: -
  • Addresses: - Add KFocusTrap and use it in KModal #746
  • Components: KFocusTrap Kmodal
  • Breaking: no
  • Impacts a11y: yes
  • Guidance: -

@lokesh-sagi125
Copy link
Contributor Author

hey @akolson @MisRob , could you please tell me what's causing the linting issue , i have already made the changes required but the issue persists.

lib/KFocusTrap.vue Outdated Show resolved Hide resolved
@akolson
Copy link
Member

akolson commented Sep 2, 2024

@lokesh-sagi125

Could you review the rest of the code and let me know if there are any changes that should be made? Thank you!

Sure!

@lokesh-sagi125 lokesh-sagi125 marked this pull request as ready for review September 2, 2024 18:51
lib/KFocusTrap.vue Outdated Show resolved Hide resolved
export default {
name: 'FocusTrap',
props: {
disabled: {
Copy link
Member

Choose a reason for hiding this comment

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

Would you document this prop? You can see other components.

The docstring will then show in the auto-generated props documentation on a documentation page for this component.

lib/KModal.vue Outdated
>
<!-- KeenUiSelect targets modal by using div.modal selector -->
<KFocusTrap>
<component :is="wrapper">
Copy link
Member

Choose a reason for hiding this comment

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

We'll need to test that when component here is KOverlay (that is, when KModal's appendToOverlay prop is true), the focus trapping still works as expected.

Just from the code I'm a bit suspicious there may be trouble. Reason being that KOverlay will move the modal content to another element #k-overlay, whereas KFocusTrap will stay in its original place in the DOM.

I know I used this structure as an example in the issue, however it was meant to be just rough guidance rather than solution, apologies if that was confusing. Let's preview for both possible appendToOverlay values and see if it needs to be adjusted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh , i should have understood the requirements properly, thanks @MisRob i will make sure to use KFocusTrap appropriately.

@MisRob
Copy link
Member

MisRob commented Sep 3, 2024

Leaving a note here that adding a documentation page for KFocusTrap is an acceptance criteria for closing #746 and there's some related guidance in the issue. @shivam-daksh let us know if you'd like to start the documentation page. It'd ideally happen in this pull request, however it's not a requirement for volunteers. Alternatively, the issue can stay partially addressed until someone gets the page ready.

@MisRob
Copy link
Member

MisRob commented Sep 3, 2024

Thanks @lokesh-sagi125 for another contribution! Just chimed in briefly and left some high-level notes. For more detailed review, I will invite @akolson and also looping in @LianaHarris360 who has had some recent experience with modals and focus trapping. Thanks all :)!

@MisRob MisRob added the TODO: needs review Waiting for review label Sep 3, 2024
Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

I agree with Misha's review so no comments on my side.
We'll however, need to test this and this could include opening a pr in Kolibri for the start. The FocusTrap component is only used in a few places in Kolibri so it could be a good opportunity to do the refactor with the same pr.

@MisRob
Copy link
Member

MisRob commented Sep 3, 2024

Ah yes, @akolson, that's a good note. I assigned learningequality/kolibri#12588 to someone else without much thinking but since the other volunteer would need to wait for this PR and we need to test it, if @lokesh-sagi125 is interested we could re-assign the related Kolibri issue. That'd make most sense but of course, depends on the time you wish to dedicate @lokesh-sagi125, no pressure.

Alternatively, only one or two places would be tested in Kolibri as part of this work.

Whatever works for you, just flagging it here so we don't have two volunteers working on the same thing :)

Co-authored-by: Michaela Robosova <[email protected]>
@lokesh-sagi125
Copy link
Contributor Author

yes @MisRob i am happy to work on issue learningequality/kolibri#12588 :), pls assign it to me.

@lokesh-sagi125
Copy link
Contributor Author

hi @MisRob @akolson i cant seem to find the playground page in the dev env. when i run yarn dev.
and yarn run deserver isnt working for me. is there any alternative?

@akolson
Copy link
Member

akolson commented Sep 3, 2024

Hi @lokesh-sagi125 , please follow the instructions that have been added as code comments in https://github.com/learningequality/kolibri-design-system/blob/7bfa45132cd70df0ddcd950e5062fcd13f234b08/docs/pages/playground.vue

@lokesh-sagi125
Copy link
Contributor Author

thanks @akolson

@akolson
Copy link
Member

akolson commented Sep 3, 2024

when i run yarn dev. and yarn run deserver isnt working for me

Not sure if you are having issues with the set up also, but installing the dependencies
yarn install
and then
yarn dev
should get you set up and running

@MisRob
Copy link
Member

MisRob commented Sep 3, 2024

yes @MisRob i am happy to work on issue learningequality/kolibri#12588 :), pls assign it to me.

@lokesh-sagi125 Great, thank you. Can you post a comment to learningequality/kolibri#12588? Otherwise I can't assign.

@shivam-daksh
Copy link
Contributor

Leaving a note here that adding a documentation page for KFocusTrap is an acceptance criteria for closing #746 and there's some related guidance in the issue. @shivam-daksh let us know if you'd like to start the documentation page. It'd ideally happen in this pull request, however it's not a requirement for volunteers. Alternatively, the issue can stay partially addressed until someone gets the page ready.

Hi @MisRob, I would love to start the documentation page.

@MisRob
Copy link
Member

MisRob commented Sep 3, 2024

@shivam-daksh I am so sorry I don't know why I tagged you, probably just clicked a bit further. It was meant for @lokesh-sagi125 :) Let's hear from @lokesh-sagi125 at first. However we have some other open documentation issues @shivam-daksh. Thanks a lot.

@MisRob
Copy link
Member

MisRob commented Sep 3, 2024

Or you two can take my typo as a nice opportunity to co-hack, heh :)! Whatever works for you. Let @lokesh-sagi125 as the author choose.

@lokesh-sagi125
Copy link
Contributor Author

hi @MisRob yes i will start the documentation page, i am very in-experienced in documentation so i would require a little bit of guidance. thank you.

@MisRob
Copy link
Member

MisRob commented Sep 4, 2024

hi @MisRob yes i will start the documentation page, i am very in-experienced in documentation so i would require a little bit of guidance. thank you.

@lokesh-sagi125 thanks! You're welcome to ask questions as you proceed, however the links in the issue already have plenty of guidance regarding technically creating the page as well as writing guidelines. I'd also recommend you examine documentation pages for other components - the underlying code and writing style too.

@akolson
Copy link
Member

akolson commented Sep 23, 2024

@MisRob any idea why this was closed?

@lokesh-sagi125
Copy link
Contributor Author

@akolson i closed the PR as i was a bit confused on solving this issue , but i had a clear idea on another issue #781 which i solved ,i didnt know how to make different PR for each issue , so i closed this PR and made another PR which has been merged.

@lokesh-sagi125
Copy link
Contributor Author

lokesh-sagi125 commented Sep 24, 2024

I will soon raise another PR for this issue. Apologies for not providing prior notice.

@AlexVelezLl
Copy link
Member

Thank you @lokesh-sagi125! No worries, please let us know if you have any question :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants