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 #799

Merged
merged 25 commits into from
Oct 28, 2024

Conversation

lokesh-sagi125
Copy link
Contributor

@lokesh-sagi125 lokesh-sagi125 commented Oct 11, 2024

Description

copy FocusTrap from kolibri into KFocusTrap in the KDS and use it in the KModal

Issue addressed

Add KFocusTrap and use it in KModal #746

Addresses #746

Before/after screenshots

before:-
https://github.com/user-attachments/assets/c38be827-683f-4d45-86b2-e845a2193744

after:-
https://github.com/user-attachments/assets/b5b27ea8-0d12-42fa-8fff-2de408a4eeb3

Changelog

  • Description: copy FocusTrap from kolibri into KFocusTrap in the KDS and use it in the KModal
  • Products impact: -
  • Addresses: Add KFocusTrap and use it in KModal #746
  • Components: KModal , KFocuaTrap
  • Breaking: no
  • Impacts a11y: -
  • Guidance: -

@lokesh-sagi125 lokesh-sagi125 marked this pull request as ready for review October 11, 2024 19:51
@lokesh-sagi125
Copy link
Contributor Author

hey @akolson @MisRob can you review this code for me , i have attached the before and after videos.i have run lint-fix multiple times and tried adding and removing an extra line but couldn't fix it .

@lokesh-sagi125
Copy link
Contributor Author

hey @MisRob i added the documentation page but i cant find a way to add info to the props as it was auto-generated i tried adding comments in the main code but it still didint show up in the documentation page , how can i add info to these parts of the documentation page
Uploading Screenshot 2024-10-14 at 11.16.53 AM.png…

@MisRob MisRob requested review from akolson and AlexVelezLl October 14, 2024 08:48
@MisRob MisRob added the TODO: needs review Waiting for review label Oct 14, 2024
@MisRob
Copy link
Member

MisRob commented Oct 14, 2024

Hi @lokesh-sagi125, thank you.

i added the documentation page but i cant find a way to add info to the props as it was auto-generated i tried adding comments in the main code but it still didint show up in the documentation page

Running the development server with yarn dev should auto-generate the documentation.

I see props documented properly, but events and slots are missing. Please inspect the KImg component source code ( example 1, example 2) and its auto-generated documentation for slots and events. That should guide you. If it still doesn't work, message us again. Note that I am soon taking time off till the end of October, so best to mention @akolson or @AlexVelezLl.

@MisRob
Copy link
Member

MisRob commented Oct 14, 2024

@akolson @AlexVelezLl I am linking the previous PR with review #764 that this PR is expected to have resolved, notably #764 (comment)

@MisRob
Copy link
Member

MisRob commented Oct 14, 2024

Related Kolibri PR learningequality/kolibri#12718

@MisRob MisRob requested review from nucleogenesis and LianaHarris360 and removed request for AlexVelezLl October 16, 2024 07:01
@MisRob
Copy link
Member

MisRob commented Oct 16, 2024

@AlexVelezLl feel free to review if you wish, I just removed you because I wanted to align reviewers with the related Kolibri PR #799 and I think you're already taking care of another reviews :)

@MisRob
Copy link
Member

MisRob commented Oct 16, 2024

Regarding releases, this won't be a breaking change, however a bit of planning as of when to merge it, depending on the state of the Kolibri PR, may be needed - cc @AlexVelezLl

},
/**
* Emits an event to notify the parent component to focus the first element.
*/
Copy link
Member

Choose a reason for hiding this comment

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

The description for the shouldFocusFirstEl event is not showing up in the docs. Please move it inside the function just above this.$emit(...)

},
/**
* Emits an event to notify the parent component to focus the last element.
*/
Copy link
Member

Choose a reason for hiding this comment

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

The description for the shouldFocusLastEl event is not showing up in the docs. Please move it inside the function just above this.$emit(...)

@focus="handleFirstTrapFocus"
></div>

<!-- Default slot where the focusable content will be rendered -->
Copy link
Member

Choose a reason for hiding this comment

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

This should be the below so that the description for the slot is added in the component's documentation. I've added @slot.

    <!-- @slot Default slot where the focusable content will be rendered -->

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.

The code changes look correct to me. I have left some comments to fix some issues with the documentation. Thanks @lokesh-sagi125

Screenshot 2024-10-21 at 16 15 18

@akolson
Copy link
Member

akolson commented Oct 21, 2024

@lokesh-sagi125 also please remember to run the below before you commit your changes so that the linting issues are also resolved. Thanks

yarn lint-fix
git add .
git commit -m "<your commit message here>"

@lokesh-sagi125
Copy link
Contributor Author

hey @akolson i have made changes to the 'KFocusTrap' component according to your guidance and all the functions are documented now
Screenshot 2024-10-22 at 5 39 52 PM
and i have tried to fix the linting issue as you told but it seems to persist, maybe due to the code being re-written after 'yarn lint-fix ' .

@akolson
Copy link
Member

akolson commented Oct 22, 2024

Hi @lokesh-sagi125, the linting issues are particularly reported in the below;

Kolibri Linter: Linting errors for lib/KFocusTrap.vue
Kolibri Linter: L14 |   
Kolibri Linter:      ^ Please use space for indentation and keep 2 length. (space-tab-mixed-disabled)
Kolibri Linter: L28 |<script>
Kolibri Linter:      ^ Need two endlines between top-level tags. (--vue-component-conventions)
Kolibri Linter: L107 |<style scoped>
Kolibri Linter:       ^ Need two endlines between top-level tags. (--vue-component-conventions)

Maybe manually adding the endlines and space as advised above could help?

@rtibbles rtibbles added this to the KDS v5.x.x milestone Oct 22, 2024
@lokesh-sagi125
Copy link
Contributor Author

yes @akolson i did try manually adding the two endlines and the indentation , but it gets formatted once i run 'yarn lint-fix' or run the devserver

@akolson
Copy link
Member

akolson commented Oct 24, 2024

@lokesh-sagi125 reformat but don't run the lint command and let's see what happens

Copy link
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

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

Just higlighted the needed changes to fix the linting issues :). Our current linter gets a bit confused when there aren't two lines between the main template, script and style blocks.

lib/KFocusTrap.vue Outdated Show resolved Hide resolved
lib/KFocusTrap.vue Outdated Show resolved Hide resolved
lib/KFocusTrap.vue Outdated Show resolved Hide resolved
lokesh-sagi125 and others added 3 commits October 24, 2024 18:42
@lokesh-sagi125
Copy link
Contributor Author

lokesh-sagi125 commented Oct 24, 2024

hey @AlexVelezLl i did commit the changes you suggested and it seems to have solved the linting issue.

@lokesh-sagi125
Copy link
Contributor Author

hi @AlexVelezLl i have come across this article , https://medium.com/learning-equality/gsoc-24-my-journey-as-a-contributor-at-learning-equality-4ed4c623b189 and was aiming to go down a similar path , how can i join the slack channel?
are there any pre-requisites?

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.

LGTM! Thanks @lokesh-sagi125. @AlexVelezLl, please feel free to merge whenever you are ready!

@AlexVelezLl
Copy link
Member

AlexVelezLl commented Oct 28, 2024

Hey @lokesh-sagi125! You can send an email to [email protected] so we can send you the invitation to our slack channel 🤗. Thank you!!

@AlexVelezLl AlexVelezLl merged commit 83d6a3b into learningequality:develop Oct 28, 2024
8 checks passed
learning-equality-bot bot pushed a commit that referenced this pull request Oct 28, 2024
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