Skip to content

Fix for sticky button CTAs#13948

Merged
alecslupu merged 5 commits intodevelopfrom
fix/sticky-footer
Jan 27, 2025
Merged

Fix for sticky button CTAs#13948
alecslupu merged 5 commits intodevelopfrom
fix/sticky-footer

Conversation

@andreslucena
Copy link
Copy Markdown
Member

🎩 What? Why?

On #13127 we did a bad merge and break the "Sticky CTAs" feature. This PR fixes it.

I also did some clean-up on its JS code: splitting it to its own file and making the code simpler.

📌 Related Issues

Testing

Sadly you need to do it manually. I tried to work on some specs but I could not made them work locally.

This is my proof of concept with the spec (that doesn't work):

diff --git a/decidim-meetings/spec/system/meeting_registrations_spec.rb b/decidim-meetings/spec/system/meeting_registrations_spec.rb
index 6366ffcf58..e665117f6e 100644
--- a/decidim-meetings/spec/system/meeting_registrations_spec.rb
+++ b/decidim-meetings/spec/system/meeting_registrations_spec.rb
@@ -152,6 +152,27 @@ describe "Meeting registrations" do
             end
           end
         end
+
+        context "and the device is a mobile" do
+          # Make the description really long so the button would be actually below
+          let!(:meeting) { create(:meeting, :published, description: { en: Faker::Lorem.paragraphs(number: 100).join }, component:, questionnaire:) }
+
+          before do
+            driven_by(:iphone)
+            visit_meeting
+          end
+
+          it "always show the registration sticky button" do
+            within "#dc-dialog-wrapper" do
+              click_on "Accept all"
+            end
+
+            expect(find("Register").visible?).to be_truthy
+
+            page.scroll_to(find("footer"))
+            expect(find("Register").visible?).to be_truthy
+          end
+        end
       end

       context "and the user is logged in" do

📷 Screenshots

Before

Page with a register button (no sticky)

After

Page with a register button (sticky)

♥️ Thank you!

@andreslucena andreslucena added type: fix PRs that implement a fix for a bug no-backport Pull Requests that should not be backported labels Jan 27, 2025
github-actions[bot]
github-actions bot previously approved these changes Jan 27, 2025
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

👍

@alecslupu alecslupu merged commit 2b83ee2 into develop Jan 27, 2025
@alecslupu alecslupu deleted the fix/sticky-footer branch January 27, 2025 18:04
antopalidi pushed a commit to openpoke/decidim that referenced this pull request Feb 12, 2025
andreslucena added a commit that referenced this pull request Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core module: dev no-backport Pull Requests that should not be backported type: fix PRs that implement a fix for a bug

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

Sticky action button is broken

2 participants