fix: add target=_blank to external resource links to prevent session loss (fixes #422)#1113
Conversation
|
@swarupio is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@komalharshita please review it! |
|
@komalharshita please merge it if there are no errors! |
|
@komalharshita please review and merge it! |
|
@komalharshita please merge it! |
|
Thank you for taking the time to contribute to DevPath and for addressing this UX issue! This is a thoughtful improvement that makes the application more user-friendly by ensuring external resources open in a new tab instead of navigating users away from DevPath. I also appreciate that you included The implementation is clean, focused, and directly resolves the reported issue without introducing unnecessary complexity. This will help users explore external documentation and resources without losing their current session or progress in the application. Thank you again for your time and effort in improving DevPath. Contributions like this make the project better for everyone. Great work! 🚀 Approved for merge. ✅ |
Summary [required]
This PR resolves an issue where clicking external documentation or resource links on the project details page navigated the user away from the DevPath application, resulting in a frustrating UX and loss of place. By adding
target="_blank"andrel="noopener noreferrer"to these anchor tags, external resources now open safely in a new browser tab.Related Issue [required]
Closes #422
Type of Change [required]
data/projects.jsonWhat Was Changed [required]
src/templates/project.htmltarget="_blank"andrel="noopener noreferrer"to the Learning Resource links (including the raw URL fallback) and the GitHub links in the navigation headers.How to Test This PR [required]
git checkout fix/422-external-linkspip install -r requirements.txtcd src && python app.pypython tests/test_basic.pyTest Results [required] :
PASS test_internal_server_error_page
PASS test_view_code_found
PASS test_download_code_found
PASS test_view_code_nested_path
PASS test_download_code_nested_path
PASS test_resolve_starter_file_path_traversal
PASS test_health_check
PASS test_scoring_weights_has_all_keys
PASS test_search_api_returns_results
PASS test_search_api_empty_query
PASS test_home_route_with_share_params
PASS test_share_banner_element_exists
PASS test_share_params_partial_loads_ok
PASS test_share_params_invalid_level_not_reflected
PASS test_share_params_xss_not_reflected
PASS test_share_params_excessive_skills_loads_ok
PASS test_api_recommend_invalid_level_no_crash
PASS test_sitemap_returns_200
PASS test_sitemap_content_type
PASS test_sitemap_contains_homepage
PASS test_sitemap_contains_all_project_ids
PASS test_robots_txt_returns_200
PASS test_robots_txt_references_sitemap
PASS test_project_links_have_noopener
PASS test_career_roadmaps_load
PASS test_compare_roadmaps_finds_overlap
PASS test_compare_same_roadmap_returns_error
PASS test_compare_invalid_roadmap_returns_none
PASS test_compare_page_route
PASS test_list_roadmaps_api
PASS test_compare_api
PASS test_compare_api_missing_params
PASS test_compare_api_not_found
PASS test_sitemap_includes_compare
77 passed, 1 failed out of 78 tests
Self-Review Checklist [required]
feat/,fix/,docs/,data/,style/,test/python tests/test_basic.pyand all 27 tests passflake8 .locally and there are no errorsprint()orconsole.log()debug statementsNotes for Reviewer
While fixing the Learning Resource links in the
project.htmltemplate, I noticed that the GitHub navigation links in the top navbar and the mobile menu were also missing these attributes and were routing to a generic URL. I updated those external links within the same template to maintain consistency and prevent scope leak.