AdvancedCustomFields / AdvancedCustomFields/acf

Extending the part how ACF is updating the block preview to provide a better user experience

Open
#821 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hey @lgladdy @polevaultweb,

I've long noticed that I can't see block changes while making changes to a range field type.

However, the user is used to seeing changes immediately when changing field values. So I have the following suggestion for improvement.

ACF is currently updating the block preview in the BlockForm class in this way:

$el.on('change keyup', () => {
    clearTimeout(timeout);
    timeout = setTimeout(serializeData, 300);
});

If we could extend this part by an input event, field changes are visible while we changing a value on a range field type:

$el.on('input', (e) => {
    const fieldType = $(e.target).attr('type');
    if( fieldType === 'range' ) {
        clearTimeout(timeout);
        timeout = setTimeout(serializeData, 100);
    }  
});
$el.on('change keyup', () => {
    clearTimeout(timeout);
    timeout = setTimeout(serializeData, 300);
});

Before:

before

After:

after

It could also make sense for other field types such as number.

Contributor guide

No contributing guide indexed for this repository

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 by locating the BlockForm class and its existing change and keyup handlers. Check how block preview serialization is triggered, then verify that range input changes update the preview during interaction; consider whether number fields should behave similarly. Done means the preview responds while changing the supported field value without breaking the existing update behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.