Migrate FtPrompt to the composition API#6551
Merged
FreeTubeBot merged 3 commits intoFreeTubeApp:developmentfrom Jan 14, 2025
Merged
Migrate FtPrompt to the composition API#6551FreeTubeBot merged 3 commits intoFreeTubeApp:developmentfrom
FreeTubeBot merged 3 commits intoFreeTubeApp:developmentfrom
Conversation
PikachuEXE
approved these changes
Jan 14, 2025
kommunarr
approved these changes
Jan 14, 2025
ChunkyProgrammer
approved these changes
Jan 14, 2025
SuperAKWA
pushed a commit
to SuperAKWA/FreeTube
that referenced
this pull request
Jan 24, 2025
* Migrate FtPrompt to the composition API * Show title for ft-share-button in the prompt on mobile * Reduce diff
OothecaPickle
pushed a commit
to OothecaPickle/FreeTube
that referenced
this pull request
Apr 29, 2025
* Migrate FtPrompt to the composition API * Show title for ft-share-button in the prompt on mobile * Reduce diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrate FtPrompt to the composition API
Pull Request Type
Description
This pull request migrates the FtPrompt component to the composition API. It also changes how the prompt label is handled.
Currently when a component specifies a custom body for the prompt it also has to take care of displaying the label with its own HTML and CSS, even if it doesn't change it from the default one. That also comes with an accessiblity issue, as the prompt has a
aria-labelledbyattribute but with the custom titles the ID isn't added, so thearia-labelledbypoints at an ID that doesn't exist.To solve those issues I decided to move the label to its own slot (appropriately named "label"), that uses scoped slots to pass the ID for the label through to the parent component that is populating the slot. That means that components that only want to customise the body can now use the default label display (using the label prop) and components that want a custom label display such as the keyboard shortcuts one (needs to show the label and close button on the same line) or the changelog (uses an
<h1>tag for the title instead of<h2>) can display a custom one and add the ID to it, so that it is correctly linked. The label prop was made optional so that components that customise its display don't have to duplicate the text into the prop.Testing
Test various prompts in FreeTube such as the subscription export, search filters, changelog (edit the version in the package.json file to 0.22.0) and check that they work correctly (looks right, buttons work, keyboard interaction, clicking outside of it closes it).
Desktop