-
Notifications
You must be signed in to change notification settings - Fork 25
feat: View/Edit tags for Library Components #400
feat: View/Edit tags for Library Components #400
Conversation
Thanks for the pull request, @yusuf-musleh! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
3593278
to
a994ed6
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #400 +/- ##
==========================================
+ Coverage 52.41% 53.14% +0.72%
==========================================
Files 75 80 +5
Lines 1986 2021 +35
Branches 359 368 +9
==========================================
+ Hits 1041 1074 +33
- Misses 912 914 +2
Partials 33 33 ☔ View full report in Codecov by Sentry. |
89bf904
to
29040ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @yusuf-musleh !
I think we can simplify a bit this code rendering the ContentTagsDrawer
conditionaly instead of hiding it using styles.
I made some tests in my stack and it worked. Let me know if you see any issues with this approach!
body.drawer-open { | ||
overflow: hidden; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With position fixed, the drawer worked fine without this.
body.drawer-open { | |
overflow: hidden; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is needed otherwise the user will be able to scroll down in the darkened part of the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood! Would you mind putting a comment in the CSS mentioning it? 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, updated the commit
@rpenido Thanks for the review! Your suggestions are great and much cleaner. I applied all of them (e0db5b7) except 1, left a comment about it above. I also added auto focus to the drawer when it opens so that it is directly accessible through the keyboard when it is opened, it works fine when I open it through the tags count button, however when I open it through the dropdown action menu, the focus still remains on the main page for some reason. Any ideas on how to approach this? const autoFocusDrawer = (drawer) => {
// Set focus to drawer when its opened
document.activeElement.blur();
if (drawer) {
drawer.focus();
}
};
// TODO: The use of an iframe in the implementation will likely change
const renderIFrame = () => (
<iframe
ref={autoFocusDrawer}
title="manage-tags-drawer"
className="w-100 h-100 border-0"
src={`${getConfig().COURSE_AUTHORING_MFE_BASE_URL}/tagging/components/widget/${openContentTagsDrawer}`}
/>
); |
The following code works for the button and the menu. const iFrameRef = useRef();
useEffect(() => {
if (openContentTagsDrawer && iFrameRef.current) {
iFrameRef.current.focus();
}
}, [openContentTagsDrawer]);
// TODO: The use of an iframe in the implementation will likely change
const renderIFrame = () => (
<iframe
ref={iFrameRef}
title="manage-tags-drawer"
className="w-100 h-100 border-0"
src={`${getConfig().COURSE_AUTHORING_MFE_BASE_URL}/tagging/components/widget/${openContentTagsDrawer}`}
/>
); However, this does not prevent the user from focusing (via return (
<ModalLayer isOpen={!!openContentTagsDrawer}>
<div role="dialog" id="manage-tags-drawer" className="drawer">
{ renderIFrame() }
</div>
</ModalLayer>
); If you think this is getting bigger, maybe we should drop it and make this refinement later. |
e0db5b7
to
0d10864
Compare
@rpenido Your suggested worked really well, thanks! It correctly set the focus to the drawer when it opens from either the tags count button or the menu button, I've updated the code to include your suggestion. I think for now this should be fine, if we need to make adjustments to it, we can do in a follow up PR. |
0d10864
to
98b5b38
Compare
98b5b38
to
27f09f5
Compare
@bradenmacdonald This is ready for CC review, not sure who we need to ping to do that? |
Hmm, according to the chart, OpenCraft doesn't have any core contributors for this repo. And since we're planning to consolidate this into course-authoring, I don't think it's worth onboarding anyone either. @arbrandes or @kdmccormick do either of you have availability to do a Core Contributor review + merge of this PR for the tagging project? |
ref={iFrameRef} | ||
title="manage-tags-drawer" | ||
className="w-100 h-100 border-0" | ||
src={`${getConfig().COURSE_AUTHORING_MFE_BASE_URL}/tagging/components/widget/${openContentTagsDrawer}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @yusuf-musleh!
Could we change this var to COURSE_AUTHORING_MICROFRONTEND_URL
?
The tutor-mfe
plugin already define it by default:
overhangio/tutor-mfe#182
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
09dbe55
to
83f12d8
Compare
@yusuf-musleh Please move "Manage Tags" above "Delete" in the overflow menu - just to keep it in line with tagging Units. |
@ali-hugo Sure thing, will update it shortly. |
83f12d8
to
e82df12
Compare
@ali-hugo Updated the order of the actions in the dropdown menu. |
Hey @arbrandes and @kdmccormick, a friendly nudge about @bradenmacdonald's comment above:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yusuf-musleh Nice work! Left a small question.
Not related to this PR but the taxonomy sample data generate script fails due to removal of tag_content_object
in this commit, had to checkout the previous commit and run the sample generation script.
- I tested this: (in devstack locally)
- I read through the code
- I checked for accessibility issues
-
Includes documentation
e82df12
to
8c4f967
Compare
@yusuf-musleh I forgot to include this before in my comment, but can we split |
@navinkarkera Good point, I've split the |
@yusuf-musleh the CLA check is not new, but assuming that you are an OpenCraft employee, it should pass no problem. If it doesn't turn green within a few hours, ping me again and I'll look into why it isn't reporting. |
Nevermind, looks like it just passed. |
@kdmccormick Oh interesting, probably just took longer this time, thanks for the insight! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yusuf-musleh Thanks for splitting it. Please rebase.
Handles opening iframe that should contain content tags drawer to manage the tags for the library component.
Also includes handling closing the the side drawer
Include tests for new functionality
a5e0748
to
a33e6ef
Compare
@navinkarkera Rebased and good to go, thanks again for the review! |
@yusuf-musleh 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
This PR adds the ability to view/edit tags for component blocks of V2 Libraries. This utilizes the already implemented content tags drawer in the course authoring MFE repo, rendering it inside an iframe.
If blocks have tags applied, the count is shown and can be clicked to open the manage tags drawer. Otherwise the manage tags option is available in the actions dropdown menu.
Supporting Information
Related Ticket:
Testing Instructions
Mange tags
, the side drawer should open and load taxonomy tags to choose fromPrivate-ref: FAL-3599