hi dae,
When I open a deck in night mode, the first card’s Front shows a blank screen. Sometimes it’s a blink, sometimes 1–2 seconds. Then an empty white page fades in, and only then does the card appear. Later cards in the session are fine. Reopening the deck or restarting AnkiMobile sometimes makes it go away and sometimes not.
I stepped through a screen recording frame by frame (30 fps, pixel colours sampled):
1.60 s: I tap the deck.
1.80–2.21 s: The review screen slides in. The card area is pure black (#000000). The gear and the counts are already drawn.
2.25–2.41 s: The card area fades from black to light grey, in 5 frames: #070707 → #191919 → #353535 → #5D5D5D → #757575 → #A7A7A7. The page is empty, with no text.
2.44 s: The card appears complete in a single frame, with the template’s dark background.
So the light flash is the web view’s empty white page fading in before the card is inserted. On slower openings, the black phase is what grows to 1–2 seconds.
It looks like the initial fade-in you mentioned in another thread, the one that lets the page finish loading. In night mode it fades in a white page, so you get a bright flash before a dark card. Could the first page take the night-mode background, or could the fade run once the first card is in place?
I’ve never seen this behavior on AnkiMobile, and I am using about the same configuration as you: iOS 27.0.1, Appearance > Dark; AnkiMobile 25.09, Night Mode > Follow System; iPhone 13. I also didn’t see this behavior with iOS 27, before updating to 27.0.1.
Have you always seen this behavior with the AnkiMobile app? Or, did it start occurring at some point?
If you fully power off your iPhone and then turn it back on, does the behavior still occur?
If you create a new test profile and a new test deck with a single plain, default Basic note type card, is be behavior still seen with that card?
Assuming that the behavior is limited to the existing cards in your deck, I’m wondering if there is something about them that might be related to the behavior? Perhaps something like custom Javascript that is slowing down the web engine upon first load? We might want a minimal example deck with one of the problem cards to see if other people can reproduce the behavior.
Yes, this slow initial (first) card loading is seen in custom Js heavy templates on Ankimobile. Although these same templates run fine on Anki Desktop.
Could you please confirm, you tried powering off your iPhone, turning it back on, and you saw that the behavior still occurred. Is this correct?
Could you please confirm, you have always seen this behavior with the problem cards, is this correct? Or, did it start occurring at some point?
Could you please confirm, the behavior does not occur with Basic note type cards, is this correct? (You seem to imply that the behavior is only seen with your custom card templates, but I just wanted to confirm whether that is the case.)
If you provide an .apkg file containing a deck with a sample problem card, it might be possible that someone could see if the problem is reproducible and further troubleshoot the issue.
Otherwise, if you want to troubleshoot the issue further yourself, you might want to experiment with removing sections of Javascript from your card templates to see if you can identify exactly what part of the code is causing the behavior.
This initial card loading delay is seen on both iPad and iPhone devices running latest Ankimobile. And the issue is not solved upon restarting the device or the application (Anki)
This occurs only on the custom js heavy templates. Basic/native note templates are not affected.
I am willing to provide the note template, but how do I share the apkg?
I tried Claude (opus 5.5), and it told me that it cannot pinpoint the exact cause because the Ankimobile app is closed source.
For sharing the .apkg file, there are free online file-sharing services available. I don’t have personal experience with it, but one that was mentioned previously on the forum is https://gofile.io
Thank you. I am away from my Mac computer for a while, so hopefully someone might be able to look at the cards in the .apkg file sooner. Otherwise, I will look at them towards the end of November.
You have an incredibly complicated custom card template, with scripts and a bunch of styling. The kind of flash or pause while loading that you’re seeing is ordinary in anything using a webview – you’d see the same thing if you loaded that much CSS and JS in Chrome or Safari. Styling & HTML - Anki Docs
A good guideline is that a problem caused by a card template should be fixed on the card template. You should be talking to the developer of that note type about whether they’ve tested it on iOS, and what they can do to improve the situation – or if that’s you, you should reconsider how much complexity and bloat you’re adding in this note type.
[I’ve moved this to the Anki > Card Design category in case anyone is interested in helping you troubleshoot at that level.]
This is the first time I’ve seen code tucked into styles.
Perhaps only the creator understands what’s going on—especially with 10,000 lines of code. Well, the actual code starts at line 4125, but that doesn’t make things any easier.
It’s not a very good practice, imo. It does work on desktop, but fails on AnkiWeb (not sure about the mobile platforms). It also isn’t a future-proof solution, since desktop might start sanitizing css at some point too (as it probably should).
Well my brother is an engineer and laid the foundation of this template and found out styling could be used for Front - Back calls to prevent redundant code.
Over the time i used AI (claude) to add to it so it became a lil messy.
I will ask my brother to help me fix this. Thanks yall.
I actually looked for the author online :), wanting to understand the concept behind this template. There’s a lot in it that I don’t quite grasp, but it clearly works the way you need it to.
It makes sense to keep all the styles in one place—especially since the styles are shared across all cards of the same note type. The code, however, varies. If your goal was to minimize the code, you could have moved it into a library file and placed it in a shared folder (just make sure the library filename begins with an underscore).
Alternatively, you could keep the code on one side and load it onto the other. I’m not familiar with all the nuances of your specific approach, though. For context, I have a card of my own that’s nearly 7,000 lines long—and even that doesn’t cover everything; in fact, it’s still quite limited. That said, having too much code isn’t ideal, particularly when it comes to complex rendering. I can’t pinpoint the exact cause of the issue with your card, as it displays correctly on my own machine; you’ll need to investigate it directly where the problem is occurring.
I converted your card into two HTML files, the kind Anki generates on a computer.
I then opened them in a browser and checked for any issues with loading times. I set the theme to dark, as you requested, but I don’t see any problems in the browser. It’s hard to say for sure without knowing exactly what code is being generated—it might be related to something else, or perhaps the code is placed in an unconventional spot within the block where the styles should be.