framework7io / framework7io/framework7

[Enhancement] Animate Expandable Card padding to respect safe area inset guidelines for iPhone X and later

Open
#3,744 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
18.8k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

Hi, I would like to suggest an improvement to animate the padding of the expanded content in Expandable Cards, so it would look nicer and unobstructed in iOS devices. I'll be happy to open new PRs for it.

When I open the Expandable Card from the official demo/kitchen sink as a PWA, the content heading and the Close button are obstructed by the system statusbar.

image

This could be fixed and improved by setting the heading's top padding to match the top safe area inset. Note that I applied them only when the card has been opened.

  .card-expandable.card-opened .card-content .card-header {
    padding-top: calc(var(--f7-card-header-padding-vertical) + var(--f7-safe-area-top));
  }
  .card-expandable.card-opened .card-content .card-close {
    top: calc(15px + var(--f7-safe-area-top)) !important;
  }

I also added several CSS rules to make the card opening and closing transitions as smooth as possible.

  .card-expandable.card-opening .card-content .card-header {
    padding-top: calc(var(--f7-card-header-padding-vertical) + var(--f7-safe-area-top));
    transform: scale(1);
    transition: 0.5s all ease;
  }
  .card-expandable.card-opening .card-content .card-close {
    top: calc(15px + var(--f7-safe-area-top)) !important;
    transform: scale(1);
    transition: 0.5s all ease;
  }
  .card-expandable.card-closing .card-content .card-header {
    transform: scale(1);
    transition: 0.5s all ease;
  }

I have implemented this fix in https://github.com/reinhart1010/aqualife-mockup/blob/lead/src/pages/explore.vue, which the final result can be found on https://reinhart1010.github.io/aqualife-mockup/ under the "Explore Tab". When previewed in iOS as a standalone web app, the card heading and the Close button are now positioned correctly.

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Expandable Card styles and the official iOS kitchen-sink demo, then compare them with the working example in src/pages/explore.vue. Verify the opened, opening, and closing states on an iPhone X or later PWA, and confirm that the heading and Close button remain clear of the safe area during the transition.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, ios, javascript
Domain
frontend, mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.