[BUG] - Deleting items in the scrollable window causes scrollbar to reset to top (#1025)

Fixes #977

Co-authored-by: Joaquin Pereyra <joaquinpereyra98@users.noreply.github.com>
This commit is contained in:
joaquinpereyra98 2025-08-19 22:07:35 -03:00 committed by GitHub
parent 774b6dbdcc
commit af250d7a61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 122 additions and 40 deletions

View file

@ -25,11 +25,22 @@ export default class AdversarySheet extends DHBaseActorSheet {
}; };
static PARTS = { static PARTS = {
sidebar: { template: 'systems/daggerheart/templates/sheets/actors/adversary/sidebar.hbs' }, sidebar: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/sidebar.hbs',
scrollable: ['.shortcut-items-section']
},
header: { template: 'systems/daggerheart/templates/sheets/actors/adversary/header.hbs' }, header: { template: 'systems/daggerheart/templates/sheets/actors/adversary/header.hbs' },
features: { template: 'systems/daggerheart/templates/sheets/actors/adversary/features.hbs' }, features: {
notes: { template: 'systems/daggerheart/templates/sheets/actors/adversary/notes.hbs' }, template: 'systems/daggerheart/templates/sheets/actors/adversary/features.hbs',
effects: { template: 'systems/daggerheart/templates/sheets/actors/adversary/effects.hbs' } scrollable: ['.feature-section']
},
notes: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/notes.hbs'
},
effects: {
template: 'systems/daggerheart/templates/sheets/actors/adversary/effects.hbs',
scrollable: ['.effects-sections']
}
}; };
/** @inheritdoc */ /** @inheritdoc */

View file

@ -78,6 +78,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
static PARTS = { static PARTS = {
sidebar: { sidebar: {
id: 'sidebar', id: 'sidebar',
scrollable: ['.shortcut-items-section'],
template: 'systems/daggerheart/templates/sheets/actors/character/sidebar.hbs' template: 'systems/daggerheart/templates/sheets/actors/character/sidebar.hbs'
}, },
header: { header: {
@ -86,22 +87,27 @@ export default class CharacterSheet extends DHBaseActorSheet {
}, },
features: { features: {
id: 'features', id: 'features',
scrollable: ['.features-sections'],
template: 'systems/daggerheart/templates/sheets/actors/character/features.hbs' template: 'systems/daggerheart/templates/sheets/actors/character/features.hbs'
}, },
loadout: { loadout: {
id: 'loadout', id: 'loadout',
scrollable: ['.items-section'],
template: 'systems/daggerheart/templates/sheets/actors/character/loadout.hbs' template: 'systems/daggerheart/templates/sheets/actors/character/loadout.hbs'
}, },
inventory: { inventory: {
id: 'inventory', id: 'inventory',
scrollable: ['.items-section'],
template: 'systems/daggerheart/templates/sheets/actors/character/inventory.hbs' template: 'systems/daggerheart/templates/sheets/actors/character/inventory.hbs'
}, },
biography: { biography: {
id: 'biography', id: 'biography',
scrollable: ['.items-section'],
template: 'systems/daggerheart/templates/sheets/actors/character/biography.hbs' template: 'systems/daggerheart/templates/sheets/actors/character/biography.hbs'
}, },
effects: { effects: {
id: 'effects', id: 'effects',
scrollable: ['.effects-sections'],
template: 'systems/daggerheart/templates/sheets/actors/character/effects.hbs' template: 'systems/daggerheart/templates/sheets/actors/character/effects.hbs'
} }
}; };

View file

@ -15,7 +15,10 @@ export default class DhCompanionSheet extends DHBaseActorSheet {
static PARTS = { static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/actors/companion/header.hbs' }, header: { template: 'systems/daggerheart/templates/sheets/actors/companion/header.hbs' },
details: { template: 'systems/daggerheart/templates/sheets/actors/companion/details.hbs' }, details: { template: 'systems/daggerheart/templates/sheets/actors/companion/details.hbs' },
effects: { template: 'systems/daggerheart/templates/sheets/actors/companion/effects.hbs' } effects: {
template: 'systems/daggerheart/templates/sheets/actors/companion/effects.hbs',
scrollable: ['.effects-sections']
}
}; };
/* -------------------------------------------- */ /* -------------------------------------------- */

View file

@ -27,9 +27,13 @@ export default class DhpEnvironment extends DHBaseActorSheet {
/**@override */ /**@override */
static PARTS = { static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/actors/environment/header.hbs' }, header: { template: 'systems/daggerheart/templates/sheets/actors/environment/header.hbs' },
features: { template: 'systems/daggerheart/templates/sheets/actors/environment/features.hbs' }, features: {
template: 'systems/daggerheart/templates/sheets/actors/environment/features.hbs',
scrollable: ['feature-section']
},
potentialAdversaries: { potentialAdversaries: {
template: 'systems/daggerheart/templates/sheets/actors/environment/potentialAdversaries.hbs' template: 'systems/daggerheart/templates/sheets/actors/environment/potentialAdversaries.hbs',
scrollable: ['items-sections']
}, },
notes: { template: 'systems/daggerheart/templates/sheets/actors/environment/notes.hbs' } notes: { template: 'systems/daggerheart/templates/sheets/actors/environment/notes.hbs' }
}; };

View file

@ -0,0 +1,17 @@
@import '../../../utils/colors.less';
.application.sheet.daggerheart.actor.dh-style.adversary {
.tab.effects {
.effects-sections {
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 5%);
padding-bottom: 20px;
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
}
}

View file

@ -0,0 +1,17 @@
@import '../../../utils/colors.less';
.application.sheet.daggerheart.actor.dh-style.companion {
.tab.effects {
.effects-sections {
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 5%);
padding-bottom: 20px;
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
}
}

View file

@ -0,0 +1,17 @@
@import '../../../utils/colors.less';
.application.sheet.daggerheart.actor.dh-style.environment {
.tab.potentialAdversaries {
.items-section {
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto;
mask-image: linear-gradient(0deg, transparent 0%, black 5%);
padding-bottom: 20px;
scrollbar-width: thin;
scrollbar-color: light-dark(@dark-blue, @golden) transparent;
}
}
}

View file

@ -4,6 +4,7 @@
@import './actors/adversary/header.less'; @import './actors/adversary/header.less';
@import './actors/adversary/sheet.less'; @import './actors/adversary/sheet.less';
@import './actors/adversary/sidebar.less'; @import './actors/adversary/sidebar.less';
@import './actors/adversary/effects.less';
@import './actors/character/biography.less'; @import './actors/character/biography.less';
@import './actors/character/effects.less'; @import './actors/character/effects.less';
@ -17,9 +18,11 @@
@import './actors/companion/details.less'; @import './actors/companion/details.less';
@import './actors/companion/header.less'; @import './actors/companion/header.less';
@import './actors/companion/sheet.less'; @import './actors/companion/sheet.less';
@import './actors/companion/effects.less';
@import './actors/environment/actions.less'; @import './actors/environment/actions.less';
@import './actors/environment/header.less'; @import './actors/environment/header.less';
@import './actors/environment/potentialAdversaries.less';
@import './actors/environment/sheet.less'; @import './actors/environment/sheet.less';
@import './items/beastform.less'; @import './items/beastform.less';

View file

@ -1,20 +1,22 @@
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}' <section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
data-group='{{tabs.effects.group}}'> data-group='{{tabs.effects.group}}'>
{{> 'daggerheart.inventory-items' <div class="effects-sections">
title='DAGGERHEART.GENERAL.activeEffects' {{> 'daggerheart.inventory-items'
type='effect' title='DAGGERHEART.GENERAL.activeEffects'
isGlassy=true type='effect'
collection=effects.actives isGlassy=true
canCreate=true collection=effects.actives
hideResources=true canCreate=true
}} hideResources=true
}}
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.inactiveEffects' title='DAGGERHEART.GENERAL.inactiveEffects'
type='effect' type='effect'
isGlassy=true isGlassy=true
collection=effects.inactives collection=effects.inactives
canCreate=true canCreate=true
hideResources=true hideResources=true
}} }}
</div>
</section> </section>

View file

@ -1,20 +1,22 @@
<section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}' <section class='tab {{tabs.effects.cssClass}} {{tabs.effects.id}}' data-tab='{{tabs.effects.id}}'
data-group='{{tabs.effects.group}}'> data-group='{{tabs.effects.group}}'>
{{> 'daggerheart.inventory-items' <div class="effects-sections">
title='DAGGERHEART.GENERAL.activeEffects' {{> 'daggerheart.inventory-items'
type='effect' title='DAGGERHEART.GENERAL.activeEffects'
isGlassy=true type='effect'
collection=effects.actives isGlassy=true
canCreate=true collection=effects.actives
hideResources=true canCreate=true
}} hideResources=true
}}
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'
title='DAGGERHEART.GENERAL.inactiveEffects' title='DAGGERHEART.GENERAL.inactiveEffects'
type='effect' type='effect'
isGlassy=true isGlassy=true
collection=effects.inactives collection=effects.inactives
canCreate=true canCreate=true
hideResources=true hideResources=true
}} }}
</div>
</section> </section>

View file

@ -3,7 +3,7 @@
data-tab='{{tabs.potentialAdversaries.id}}' data-tab='{{tabs.potentialAdversaries.id}}'
data-group='{{tabs.potentialAdversaries.group}}' data-group='{{tabs.potentialAdversaries.group}}'
> >
<div class="action-section"> <div class="items-section">
{{#each document.system.potentialAdversaries as |category categoryId|}} {{#each document.system.potentialAdversaries as |category categoryId|}}
{{> 'daggerheart.inventory-items' {{> 'daggerheart.inventory-items'
title=category.label title=category.label