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

fix #154 (task 1): Restrict AskOpenCanvas visibility to renderer boundaries #187

Merged

Conversation

ahmad2b
Copy link
Contributor

@ahmad2b ahmad2b commented Nov 5, 2024

This PR implements boundary validation for AskOpenCanvas visibility, ensuring it only appears for text selections within the code/markdown renderer.

Implementation

  • Added isValidSelectionOrigin state for selection boundary tracking
  • Created isWithinArtifact helper for DOM node validation
  • Updated handleMouseUp to verify selection boundaries
  • Added boundary condition checks to AskOpenCanvas rendering
  • Implemented cleanup for selection state

Testing

  • Verified AskOpenCanvas only shows within the renderer
  • Confirmed no popups outside boundaries

Addresses first task from #154 - "Ensure the Ask Open Canvas input never shows up if the text is highlighted outside of the code/markdown renderer"

Let me know if you'd like any changes or any additional information.

Part of larger UX improvements outlined in #154.

askopencanvas.visibility.mp4

Copy link

vercel bot commented Nov 5, 2024

@ahmad2b is attempting to deploy a commit to the LangChain Team on Vercel.

A member of the Team first needs to authorize it.

@bracesproul bracesproul changed the base branch from main to staging November 5, 2024 20:50
Copy link
Member

@bracesproul bracesproul left a comment

Choose a reason for hiding this comment

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

great, thank you!

@bracesproul bracesproul merged commit b5999f8 into langchain-ai:staging Nov 11, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants