Repository: musescore/MuseScore (2025-07-01T17:09:44Z)

Issue:
Slur on grace note not deleted after select all + delete
### Issue type

UX/Interaction bug (incorrect behaviour)

### Description with steps to reproduce

1. Open a score
2. Press A, /, S to write a quarter note with a slurred grace note
3. Select all, delete, slur remains

### Supporting files, videos and screenshots

https://github.com/user-attachments/assets/aa5550b5-6aa9-4460-b59d-4d6297b068da

### What is the latest version of MuseScore Studio where this issue is present?

OS: macOS Sequoia (15.5), Arch.: arm64, MuseScore Studio version (64-bit): 4.6.0-251810327, revision: github-musescore-musescore-015978d

### Regression

Yes, this works in the latest released version and is broken in the nightly builds

### Operating system

MacOS15

### Additional context

_No response_

### Checklist

- [x] This report follows the [guidelines](https://github.com/musescore/MuseScore/wiki/Reporting-bugs-and-issues) for reporting bugs and issues
- [x] I have verified that this issue has not been logged before, by searching the [issue tracker](https://github.com/musescore/MuseScore/issues) for similar issues
- [x] I have attached all requested files and information to this report
- [x] I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible


Discussion:
I'm gonna go ahead and self-assign this one. ~~That'll be caused by #28111 or one of its follow-up PRs~~

Edit: Caused by #27624 (a prerequisite for #28111)



Patch:
diff --git a/src/engraving/dom/edit.cpp b/src/engraving/dom/edit.cpp
index 9d9ea46537214..79d6754fe0b6a 100644
--- a/src/engraving/dom/edit.cpp
+++ b/src/engraving/dom/edit.cpp
@@ -3527,30 +3527,42 @@ void Score::deleteOrShortenOutSpannersFromRange(const Fraction& t1, const Fracti
         Spanner* sp = i.value;
         Fraction spStartTick = sp->tick();
         Fraction spEndTick = sp->tick2();
-        if (sp->isVolta() || sp->systemFlag()) {
+        const bool trackValid = sp->track() >= track1 && sp->track() < track2;
+        if (!trackValid || sp->isVolta() || sp->systemFlag()) {
             continue;
         }
+
+        // Special handling for grace notes...
+        const Chord* startChord = sp->startChord();
+        const bool startChordIsSelectableGrace = startChord && startChord->isGrace() && filter.canSelect(startChord);
+
+        const Chord* endChord = sp->endChord();
+        const bool endChordIsSelectableGrace = endChord && endChord->isGrace() && filter.canSelect(endChord);
+
+        if (startChordIsSelectableGrace || endChordIsSelectableGrace) {
+            undoRemoveElement(sp);
+            continue;
+        }
+
         if (!filter.canSelectVoice(sp->track()) || !filter.canSelect(sp)) {
             continue;
         }
-        if (sp->track() >= track1 && sp->track() < track2) {
-            if (spStartTick >= t1 && spStartTick < t2
-                && spEndTick >= t1 && spEndTick <= t2) {
-                undoRemoveElement(sp);
-            } else if (sp->isSlur() && ((spStartTick >= t1 && spStartTick < t2)
-                                        || (spEndTick >= t1 && spEndTick < t2))) {
-                undoRemoveElement(sp);
-            } else if (muse::contains(SPANNER_TYPES_TO_SHORTEN_OUT, sp->type())) {
-                bool moveStart = spStartTick >= t1 && spStartTick < t2;
-                bool moveEnd = spEndTick > t1 && spEndTick <= t2;
-                if (moveStart) {
-                    Fraction tickDiff = t2 - spStartTick;
-                    sp->undoChangeProperty(Pid::SPANNER_TICK, t2);
-                    sp->undoChangeProperty(Pid::SPANNER_TICKS, sp->ticks() - tickDiff);
-                } else if (moveEnd) {
-                    Fraction tickDiff = spEndTick - t1;
-                    sp->undoChangeProperty(Pid::SPANNER_TICKS, sp->ticks() - tickDiff);
-                }
+        if (spStartTick >= t1 && spStartTick < t2
+            && spEndTick > t1 && spEndTick <= t2) {
+            undoRemoveElement(sp);
+        } else if (sp->isSlur() && ((spStartTick >= t1 && spStartTick < t2)
+                                    || (spEndTick >= t1 && spEndTick < t2))) {
+            undoRemoveElement(sp);
+        } else if (muse::contains(SPANNER_TYPES_TO_SHORTEN_OUT, sp->type())) {
+            bool moveStart = spStartTick >= t1 && spStartTick < t2;
+            bool moveEnd = spEndTick > t1 && spEndTick <= t2;
+            if (moveStart) {
+                Fraction tickDiff = t2 - spStartTick;
+                sp->undoChangeProperty(Pid::SPANNER_TICK, t2);
+                sp->undoChangeProperty(Pid::SPANNER_TICKS, sp->ticks() - tickDiff);
+            } else if (moveEnd) {
+                Fraction tickDiff = spEndTick - t1;
+                sp->undoChangeProperty(Pid::SPANNER_TICKS, sp->ticks() - tickDiff);
             }
         }
     }
@@ -3724,9 +3736,14 @@ void Score::deleteRangeAtTrack(std::vector<ChordRest*>& crsToSelect, const track
             }
             for (EngravingItem* graceElem : anchoredToGrace) {
                 if (filter.canSelect(graceElem)) {
+                    // Delete elements anchored to grace note...
                     undoRemoveElement(graceElem);
                 }
             }
+            if (filter.canSelect(elem)) {
+                // Delete grace note itself...
+                undoRemoveElement(elem);
+            }
         }
 
         if (cr1->isRestFamily()) {
@@ -3809,7 +3826,7 @@ std::vector<ChordRest*> Score::deleteRange(Segment* s1, Segment* s2, track_idx_t
     }
 
     const Fraction startTick = s1->tick();
-    const Fraction endTick = s2 ? s2->tick() : Fraction::max();
+    const Fraction endTick = s2 ? s2->tick() : lastMeasure()->endTick();
 
     deleteOrShortenOutSpannersFromRange(startTick, endTick, track1, track2, filter);
     deleteAnnotationsFromRange(s1, s2, track1, track2, filter);
diff --git a/src/engraving/dom/select.cpp b/src/engraving/dom/select.cpp
index cdb060e9d35b9..bef3687429259 100644
--- a/src/engraving/dom/select.cpp
+++ b/src/engraving/dom/select.cpp
@@ -824,27 +824,22 @@ void Selection::updateSelectedElements()
             continue;
         }
 
-        if (!canSelectVoice(sp->track()) || sp->isVolta()) {
+        const bool startAndEndCalculated = sp->startElement() && sp->endElement();
+        if (!startAndEndCalculated || !canSelectVoice(sp->track()) || sp->isVolta()) {
             continue;
         }
 
-        // ignore if start & end elements are not calculated yet, or if spanner is outside selection range
-        const bool isInRange = rangeStart < sp->tick2() && rangeEnd > sp->tick();
-        const bool startAndEndCalculated = sp->startElement() && sp->endElement();
-        if (!isInRange || !startAndEndCalculated) {
+        //! NOTE: isZeroLengthAtStart (for lack of a better name) covers an edge case that may occur if sp spans from
+        //! a grace note to its parent note or vice versa. In this scenario sp->tick == sp->tick2 == rangeStart and
+        //! we should include the spanner in our selection...
+        const bool overlapsSelectionRange = rangeStart < sp->tick2() && rangeEnd > sp->tick();
+        const bool isZeroLengthAtStart = sp->tick() == sp->tick2() && sp->tick() == rangeStart;
+        if (!overlapsSelectionRange && !isZeroLengthAtStart) {
             continue;
         }
 
-        const EngravingItem* startCR = sp->startCR();
-        const EngravingItem* endCR = sp->endCR();
-
-        const bool canSelectStart = sp->startElement()->isTimeTickAnchor() || sp->startElement()->isSegment() || canSelect(startCR);
-        const bool canSelectEnd = sp->endElement()->isTimeTickAnchor() || sp->endElement()->isSegment() || canSelect(endCR);
-
-        if (canSelectStart && canSelectEnd) {
-            for (auto seg : sp->spannerSegments()) {
-                appendFiltered(seg);
-            }
+        for (auto seg : sp->spannerSegments()) {
+            appendFiltered(seg);
         }
     }
     update();
diff --git a/src/engraving/dom/spanner.cpp b/src/engraving/dom/spanner.cpp
index dcf760bfb17b4..993a72abae892 100644
--- a/src/engraving/dom/spanner.cpp
+++ b/src/engraving/dom/spanner.cpp
@@ -982,7 +982,9 @@ void Spanner::setNoteSpan(Note* startNote, Note* endNote)
 
 Chord* Spanner::startChord()
 {
-    assert(m_anchor == Anchor::CHORD);
+    if (m_anchor != Anchor::CHORD) {
+        return nullptr;
+    }
     if (!m_startElement) {
         m_startElement = findStartChord();
     }
@@ -1000,7 +1002,9 @@ Chord* Spanner::startChord()
 
 Chord* Spanner::endChord()
 {
-    assert(m_anchor == Anchor::CHORD);
+    if (m_anchor != Anchor::CHORD) {
+        return nullptr;
+    }
     if (!m_endElement && type() == ElementType::SLUR) {
         m_endElement = findEndChord();
     }


Test patch:
diff --git a/src/engraving/tests/selectionfilter_data/selectionfilter_gracesandslurs-ref.mscx b/src/engraving/tests/selectionfilter_data/selectionfilter_gracesandslurs-ref.mscx
new file mode 100644
index 0000000000000..49a6e92082a0f
--- /dev/null
+++ b/src/engraving/tests/selectionfilter_data/selectionfilter_gracesandslurs-ref.mscx
@@ -0,0 +1,632 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<museScore version="4.60">
+  <Score>
+    <eid>B_B</eid>
+    <Division>480</Division>
+    <Style>
+      <maskBarlinesForText>0</maskBarlinesForText>
+      <scaleRythmicSpacingForSmallNotes>0</scaleRythmicSpacingForSmallNotes>
+      <verticallyAlignChordSymbols>0</verticallyAlignChordSymbols>
+      <changesBeforeBarlineRepeats>0</changesBeforeBarlineRepeats>
+      <changesBeforeBarlineOtherJumps>0</changesBeforeBarlineOtherJumps>
+      <showCourtesiesRepeats>0</showCourtesiesRepeats>
+      <showCourtesiesOtherJumps>0</showCourtesiesOtherJumps>
+      <showCourtesiesAfterCancellingRepeats>0</showCourtesiesAfterCancellingRepeats>
+      <showCourtesiesAfterCancellingOtherJumps>0</showCourtesiesAfterCancellingOtherJumps>
+      <spatium>1.74978</spatium>
+      </Style>
+    <showInvisible>1</showInvisible>
+    <showUnprintable>1</showUnprintable>
+    <showFrames>1</showFrames>
+    <showMargins>0</showMargins>
+    <metaTag name="arranger"></metaTag>
+    <metaTag name="audioComUrl"></metaTag>
+    <metaTag name="composer">Composer / arranger</metaTag>
+    <metaTag name="copyright"></metaTag>
+    <metaTag name="lyricist"></metaTag>
+    <metaTag name="movementNumber"></metaTag>
+    <metaTag name="movementTitle"></metaTag>
+    <metaTag name="source"></metaTag>
+    <metaTag name="sourceRevisionId"></metaTag>
+    <metaTag name="subtitle">Subtitle</metaTag>
+    <metaTag name="translator"></metaTag>
+    <metaTag name="workNumber"></metaTag>
+    <metaTag name="workTitle">Untitled score</metaTag>
+    <Order id="orchestral">
+      <name>Orchestral</name>
+      <instrument id="piano">
+        <family id="keyboards">Keyboards</family>
+        </instrument>
+      <section id="woodwind" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>flutes</family>
+        <family>oboes</family>
+        <family>clarinets</family>
+        <family>saxophones</family>
+        <family>bassoons</family>
+        <unsorted group="woodwinds"/>
+        </section>
+      <section id="brass" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>horns</family>
+        <family>trumpets</family>
+        <family>cornets</family>
+        <family>flugelhorns</family>
+        <family>trombones</family>
+        <family>tubas</family>
+        </section>
+      <section id="timpani" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>timpani</family>
+        </section>
+      <section id="percussion" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>keyboard-percussion</family>
+        <family>drums</family>
+        <family>unpitched-metal-percussion</family>
+        <family>unpitched-wooden-percussion</family>
+        <family>other-percussion</family>
+        </section>
+      <family>keyboards</family>
+      <family>harps</family>
+      <family>organs</family>
+      <family>synths</family>
+      <soloists/>
+      <section id="voices" brackets="true" barLineSpan="false" thinBrackets="true">
+        <family>voices</family>
+        <family>voice-groups</family>
+        </section>
+      <section id="strings" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>orchestral-strings</family>
+        </section>
+      <unsorted/>
+      </Order>
+    <Part id="1">
+      <Staff>
+        <eid>C_C</eid>
+        <StaffType group="pitched">
+          <name>stdNormal</name>
+          </StaffType>
+        <bracket type="1" span="2" col="2" visible="1"/>
+        <barLineSpan>1</barLineSpan>
+        </Staff>
+      <trackName>Piano</trackName>
+      <Instrument id="piano">
+        <longName>Piano</longName>
+        <shortName>Pno.</shortName>
+        <trackName>Piano</trackName>
+        <minPitchP>21</minPitchP>
+        <maxPitchP>108</maxPitchP>
+        <minPitchA>21</minPitchA>
+        <maxPitchA>108</maxPitchA>
+        <instrumentId>keyboard.piano</instrumentId>
+        <clef staff="2">F</clef>
+        <Articulation>
+          <velocity>100</velocity>
+          <gateTime>95</gateTime>
+          </Articulation>
+        <Articulation name="staccatissimo">
+          <velocity>100</velocity>
+          <gateTime>33</gateTime>
+          </Articulation>
+        <Articulation name="staccato">
+          <velocity>100</velocity>
+          <gateTime>50</gateTime>
+          </Articulation>
+        <Articulation name="portato">
+          <velocity>100</velocity>
+          <gateTime>67</gateTime>
+          </Articulation>
+        <Articulation name="tenuto">
+          <velocity>100</velocity>
+          <gateTime>100</gateTime>
+          </Articulation>
+        <Articulation name="marcato">
+          <velocity>120</velocity>
+          <gateTime>67</gateTime>
+          </Articulation>
+        <Articulation name="sforzato">
+          <velocity>150</velocity>
+          <gateTime>100</gateTime>
+          </Articulation>
+        <Articulation name="sforzatoStaccato">
+          <velocity>150</velocity>
+          <gateTime>50</gateTime>
+          </Articulation>
+        <Articulation name="marcatoStaccato">
+          <velocity>120</velocity>
+          <gateTime>50</gateTime>
+          </Articulation>
+        <Articulation name="marcatoTenuto">
+          <velocity>120</velocity>
+          <gateTime>100</gateTime>
+          </Articulation>
+        <Channel>
+          <program value="0"/>
+          </Channel>
+        </Instrument>
+      </Part>
+    <Staff id="1">
+      <Measure>
+        <eid>D_D</eid>
+        <voice>
+          <KeySig>
+            <eid>E_E</eid>
+            <concertKey>0</concertKey>
+            </KeySig>
+          <TimeSig>
+            <eid>F_F</eid>
+            <sigN>6</sigN>
+            <sigD>8</sigD>
+            </TimeSig>
+          <StaffText>
+            <eid>G_G</eid>
+            <text>All unchecked in filter</text>
+            </StaffText>
+          <Chord>
+            <eid>H_H</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>I_I</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>J_J</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>K_K</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>L_L</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>M_M</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <Note>
+              <eid>N_N</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>O_O</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>P_P</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>Q_Q</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>R_R</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>S_S</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>T_T</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>U_U</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>V_V</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>W_W</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>X_X</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>Y_Y</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>Z_Z</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>a_a</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <Note>
+              <eid>b_b</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>c_c</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>d_d</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>e_e</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>f_f</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>g_g</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          </voice>
+        </Measure>
+      <Measure>
+        <eid>h_h</eid>
+        <LayoutBreak>
+          <eid>i_i</eid>
+          <subtype>line</subtype>
+          </LayoutBreak>
+        <voice>
+          <StaffText>
+            <eid>j_j</eid>
+            <text>Graces and slurs selected in filter</text>
+            </StaffText>
+          <Chord>
+            <eid>k_k</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>l_l</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>m_m</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>n_n</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>o_o</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>p_p</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>q_q</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>r_r</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>s_s</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>t_t</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>u_u</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>v_v</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>w_w</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>x_x</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>y_y</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          </voice>
+        </Measure>
+      <Measure>
+        <eid>z_z</eid>
+        <voice>
+          <StaffText>
+            <eid>0_0</eid>
+            <text>Graces selected in filter:</text>
+            </StaffText>
+          <Chord>
+            <eid>1_1</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>2_2</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>3_3</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>4_4</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>5_5</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>6_6</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>7_7</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>8_8</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>9_9</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>+_+</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>/_/</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>AB_AB</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>BB_BB</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>CB_CB</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>DB_DB</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          </voice>
+        </Measure>
+      <Measure>
+        <eid>EB_EB</eid>
+        <voice>
+          <StaffText>
+            <eid>FB_FB</eid>
+            <text>Slurs selected in filter:</text>
+            </StaffText>
+          <Chord>
+            <eid>GB_GB</eid>
+            <durationType>eighth</durationType>
+            <acciaccatura/>
+            <Note>
+              <eid>HB_HB</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>IB_IB</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>JB_JB</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>KB_KB</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>LB_LB</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>MB_MB</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>NB_NB</eid>
+            <durationType>eighth</durationType>
+            <acciaccatura/>
+            <Note>
+              <eid>OB_OB</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>PB_PB</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>QB_QB</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>RB_RB</eid>
+            <durationType>eighth</durationType>
+            <acciaccatura/>
+            <Note>
+              <eid>SB_SB</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>TB_TB</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>UB_UB</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>VB_VB</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>WB_WB</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>XB_XB</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>YB_YB</eid>
+            <durationType>eighth</durationType>
+            <acciaccatura/>
+            <Note>
+              <eid>ZB_ZB</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>aB_aB</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>bB_bB</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>cB_cB</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          </voice>
+        </Measure>
+      </Staff>
+    </Score>
+  </museScore>
diff --git a/src/engraving/tests/selectionfilter_data/selectionfilter_gracesandslurs.mscx b/src/engraving/tests/selectionfilter_data/selectionfilter_gracesandslurs.mscx
new file mode 100755
index 0000000000000..9b583a7bdae4a
--- /dev/null
+++ b/src/engraving/tests/selectionfilter_data/selectionfilter_gracesandslurs.mscx
@@ -0,0 +1,869 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<museScore version="4.60">
+  <Score>
+    <eid>B_B</eid>
+    <Division>480</Division>
+    <Style>
+      <spatium>1.74978</spatium>
+      </Style>
+    <showInvisible>1</showInvisible>
+    <showUnprintable>1</showUnprintable>
+    <showFrames>1</showFrames>
+    <showMargins>0</showMargins>
+    <metaTag name="arranger"></metaTag>
+    <metaTag name="audioComUrl"></metaTag>
+    <metaTag name="composer">Composer / arranger</metaTag>
+    <metaTag name="copyright"></metaTag>
+    <metaTag name="lyricist"></metaTag>
+    <metaTag name="movementNumber"></metaTag>
+    <metaTag name="movementTitle"></metaTag>
+    <metaTag name="source"></metaTag>
+    <metaTag name="sourceRevisionId"></metaTag>
+    <metaTag name="subtitle">Subtitle</metaTag>
+    <metaTag name="translator"></metaTag>
+    <metaTag name="workNumber"></metaTag>
+    <metaTag name="workTitle">Untitled score</metaTag>
+    <Order id="orchestral">
+      <name>Orchestral</name>
+      <instrument id="piano">
+        <family id="keyboards">Keyboards</family>
+        </instrument>
+      <section id="woodwind" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>flutes</family>
+        <family>oboes</family>
+        <family>clarinets</family>
+        <family>saxophones</family>
+        <family>bassoons</family>
+        <unsorted group="woodwinds"/>
+        </section>
+      <section id="brass" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>horns</family>
+        <family>trumpets</family>
+        <family>cornets</family>
+        <family>flugelhorns</family>
+        <family>trombones</family>
+        <family>tubas</family>
+        </section>
+      <section id="timpani" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>timpani</family>
+        </section>
+      <section id="percussion" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>keyboard-percussion</family>
+        <family>drums</family>
+        <family>unpitched-metal-percussion</family>
+        <family>unpitched-wooden-percussion</family>
+        <family>other-percussion</family>
+        </section>
+      <family>keyboards</family>
+      <family>harps</family>
+      <family>organs</family>
+      <family>synths</family>
+      <soloists/>
+      <section id="voices" brackets="true" barLineSpan="false" thinBrackets="true">
+        <family>voices</family>
+        <family>voice-groups</family>
+        </section>
+      <section id="strings" brackets="true" barLineSpan="true" thinBrackets="true">
+        <family>orchestral-strings</family>
+        </section>
+      <unsorted/>
+      </Order>
+    <Part id="1">
+      <Staff>
+        <eid>+5XUqCgm/hJ_SIav7Kc8UvE</eid>
+        <StaffType group="pitched">
+          <name>stdNormal</name>
+          </StaffType>
+        <bracket type="1" span="2" col="2" visible="1"/>
+        <barLineSpan>1</barLineSpan>
+        </Staff>
+      <trackName>Piano</trackName>
+      <Instrument id="piano">
+        <longName>Piano</longName>
+        <shortName>Pno.</shortName>
+        <trackName>Piano</trackName>
+        <minPitchP>21</minPitchP>
+        <maxPitchP>108</maxPitchP>
+        <minPitchA>21</minPitchA>
+        <maxPitchA>108</maxPitchA>
+        <instrumentId>keyboard.piano</instrumentId>
+        <clef staff="2">F</clef>
+        <Articulation>
+          <velocity>100</velocity>
+          <gateTime>95</gateTime>
+          </Articulation>
+        <Articulation name="staccatissimo">
+          <velocity>100</velocity>
+          <gateTime>33</gateTime>
+          </Articulation>
+        <Articulation name="staccato">
+          <velocity>100</velocity>
+          <gateTime>50</gateTime>
+          </Articulation>
+        <Articulation name="portato">
+          <velocity>100</velocity>
+          <gateTime>67</gateTime>
+          </Articulation>
+        <Articulation name="tenuto">
+          <velocity>100</velocity>
+          <gateTime>100</gateTime>
+          </Articulation>
+        <Articulation name="marcato">
+          <velocity>120</velocity>
+          <gateTime>67</gateTime>
+          </Articulation>
+        <Articulation name="sforzato">
+          <velocity>150</velocity>
+          <gateTime>100</gateTime>
+          </Articulation>
+        <Articulation name="sforzatoStaccato">
+          <velocity>150</velocity>
+          <gateTime>50</gateTime>
+          </Articulation>
+        <Articulation name="marcatoStaccato">
+          <velocity>120</velocity>
+          <gateTime>50</gateTime>
+          </Articulation>
+        <Articulation name="marcatoTenuto">
+          <velocity>120</velocity>
+          <gateTime>100</gateTime>
+          </Articulation>
+        <Channel>
+          <program value="0"/>
+          <synti>Fluid</synti>
+          </Channel>
+        </Instrument>
+      </Part>
+    <Staff id="1">
+      <Measure>
+        <eid>il2ZIxUZ95K_F1r6VoLfZfE</eid>
+        <voice>
+          <KeySig>
+            <eid>oMs9uJNlLtF_HpH8WJsVsuG</eid>
+            <concertKey>0</concertKey>
+            </KeySig>
+          <TimeSig>
+            <eid>8Y5OJ4vbFEG_J5VY5nkKtkH</eid>
+            <sigN>6</sigN>
+            <sigD>8</sigD>
+            </TimeSig>
+          <StaffText>
+            <eid>T94bms2ATTC_qhDIRKDh7SI</eid>
+            <text>All unchecked in filter</text>
+            </StaffText>
+          <Chord>
+            <eid>Dm0NSaCFTfL_LEIWFbVwMAN</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>7E+B1li6ZlC_R1n4dfmZosD</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>ECILIZrZDDJ_qu/Ppb70iSN</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>NOBKAGvpmjL_QasZcdliV6H</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>4GSTgYv1WlO_6sN9PmtiQuO</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>wcUwO/EZB7G_crtWIv6pWEI</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <Note>
+              <eid>HAPManPwkDF_Tdok2ruiG0H</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>F99k1po3KQE_Q9RIfq6+36N</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>uXsbmPyNtqC_3YkoQdCNNEP</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>Cll+oHwFeAH_6xgPf6o7qMO</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>piz+SmzeURP_ynH/dwHAKIC</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>iRtrIyUvkFG_xzsRxkjMDsP</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>K3hkVUH6I6I_8CdFsXugcJJ</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>iGI7UXBjySG_CpbhCgBRL4G</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>g8B0eLHkB3D_kWvKZBTaovG</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>wvg7gumwSAF_xcF6HJFC7rD</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>iAgLYqbK8MF_ajkkLwOJQGH</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>5wKRJZNXvEP_l4Dnq1jSoEN</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>d8Imqp59fkD_70nSU55xRkF</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>Z70XTRVn5C_mZ+ZGQFUKN</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <Note>
+              <eid>Jv1+pbvlf7L_kGmtYFFPK6L</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>1aozrtPgTrG_GYejskNe/qP</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>POGrgyfMWlK_e2OxmS2CklC</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>+kej17egYmP_D42DsPqHo3G</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>93GWWmyT6FH_8qdYsxLDTvM</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>t/FDcWuS22M_IgasUMRrs6C</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          </voice>
+        </Measure>
+      <Measure>
+        <eid>/0ln+6flz7O_t4ApqczGJdG</eid>
+        <LayoutBreak>
+          <eid>oEyEyOk1XpE_myFvUbIcgFP</eid>
+          <subtype>line</subtype>
+          </LayoutBreak>
+        <voice>
+          <StaffText>
+            <eid>zfQBokZZS8K_N9IVY7x98UJ</eid>
+            <text>Graces and slurs selected in filter</text>
+            </StaffText>
+          <Chord>
+            <eid>TbbVUTU1VsN_dqe0ZECrYGB</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>HIMGAqdbGXH_jibiZyeMQ+F</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>ZGJfOEtblFO_5L1eVdQ+sDN</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>BYSaASsvyiO_4OC8Oi0Pm6G</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>cBUn7ch7J8D_2tpidygbYEI</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>MIhg5F6fd4O_S3LHlHNc3+E</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <Note>
+              <eid>vJy3rFxGZNM_zgoDnOtJ8hD</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>pIIo/Y/q2cN_SAWs9RPhOuN</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>qByjenC4GRE_GfnrtiV8ufD</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>g4lIjs2WbBJ_ZhjfvQNLCxO</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>X1rGpda56aC_rqJGxrUSa9J</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>EL/0HPspK5L_uQptoufQrFJ</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>g7hmRBhh1OD_V4IMaXpo+nL</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>hN34en9mPKI_rv2my0OPJ1K</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>rd2BMnGmOZC_udJJ5CfBoDB</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>Q4GsvmDVj5M_s9RhUN1s1cM</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>y+thdrzvSlN_gh4JLgtYQvK</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>I7uCwL+LZ4C_/PFiUBhH+T</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>bwlM5IeHmVJ_58a7g9+/rRJ</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>QW4lbQtfXkL_EC6o/HaZfg</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <Note>
+              <eid>R0rwYo3iUJK_MQHMaRKd6FJ</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>tir354OzWmK_VVaqAdJnivK</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>Ly9xNkaKnxK_ngxBx6fEDIL</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>EbUuQBGt2LH_JQ+eoDckLRM</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>4jdMn8BsHAI_4fJEpKfh5qB</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>mpETHkf4rdF_K9f9xSE3XgP</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          </voice>
+        </Measure>
+      <Measure>
+        <eid>iKHt4kHMtGF_AgLtyP8qyrJ</eid>
+        <voice>
+          <StaffText>
+            <eid>wwbV0HPvXmC_HsgAXU3hchC</eid>
+            <text>Graces selected in filter:</text>
+            </StaffText>
+          <Chord>
+            <eid>/+0uYBJsP8I_5qeEJ6K51gI</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>UBSGUFpuj8L_/MGrSjZIsDB</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>lxpUZvv5vxJ_qjz0dNXeygC</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>b1Po6gWgp2L_pXVBYABUyjG</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>Fzxhxmw0jnL_BgMdE4KQKIH</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>ep5q145mcCK_vzEwirJDf5O</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <Note>
+              <eid>7RjM7yY3eAP_cc5/2IzA+qH</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>IELm6L3JV6O_fdIW8qLybKF</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>INeJESzvu2C_d9H/cjwXo2N</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>omL/6TPTl5D_p86VBPZSDPB</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>mhOw5BEXoBO_DLBNqkkgQyB</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>e8BPnqgM3VO_wRFwpuN6mwP</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>K4l+3GJA90K_K8KFKMHNYjE</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>PcIvRWq7/3M_KgPqZlmbOnH</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>KfMCYaT9IgP_4zyy9UN+tKI</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>9MpHjZKNb6M_5h53faOrwBF</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>yC+QmItz4YC_u2CP51IcYAE</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>XYwinJuSrnK_mN+++/DLzjI</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>yV+QZHiKm/D_WI3nmoa3wRH</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>x13+cp0sGwI_MIbYPJOD0e</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <Note>
+              <eid>1t/nrAV3ynD_NjjZXUGK4AP</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>4Gmu8nwFbVO_jqDx1TitnR</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>DghMnQsY8CG_jcXotV04xTB</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>U8I8KiFfGMG_Ibn//tfMxLO</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>Ndnl+Fw7g5F_6yhWnhKRV1O</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>s0jQ4KtyWVO_q5lUZgTJJiJ</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          </voice>
+        </Measure>
+      <Measure>
+        <eid>Z/KawUaVtxI_GJoIB2JlyOD</eid>
+        <voice>
+          <StaffText>
+            <eid>xjSvZgvqVcB_4yLLbO6Z7zF</eid>
+            <text>Slurs selected in filter:</text>
+            </StaffText>
+          <Chord>
+            <eid>6/Td8tNCX9P_7hzxfnTW4RM</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>GgxEnvKsDFH_a824mwyiiMB</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>7uFS4F0grwG_L98GTQoEGEK</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>TQ/ui9uNVz_VJwqz54dYEM</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>BkUOZjUs9XN_e1C01hIpzMI</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>dQDg/adaeNC_xR/IITyj3DH</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <Note>
+              <eid>ZN87VI7oGoD_eNTnOPuksSD</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>9PljfQZ4c4I_lJOC5yQkslG</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>zbfl8lis/VK_NEKHOcB5gKE</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>jse0FC9PwEF_65NDqe6uJaI</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>gEqo2ozQLfH_Jzq4hmZkYfC</eid>
+              <pitch>64</pitch>
+              <tpc>18</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>2W9nPkYBV1G_QV70LC+YmwB</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>+aFhjUS+/xH_WENWa5OVv0I</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>yCLNC1kU5wN_6R+rg9soFzF</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>WR189DvNNVK_T+IDV9ir6PB</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>WQcbio+S/6P_1d+UEX9kWSC</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>CkCkmJTkG2C_pl70RsYEbxO</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>5u4X3+4+4fH_KwPk+vuDxJC</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>p11W/GZQe2C_n5J9cxBoWYC</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <Slur>
+                <eid>uRSId/eh83N_Q7G/0QpijwL</eid>
+                </Slur>
+              <next>
+                <location>
+                  <fractions>1/8</fractions>
+                  <grace>0</grace>
+                  </location>
+                </next>
+              </Spanner>
+            <Note>
+              <eid>pNlp74ITKbD_yIJ4GzqoaNF</eid>
+              <pitch>67</pitch>
+              <tpc>15</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>H6Q4IWxR1BD_wgJvqJi507E</eid>
+            <durationType>eighth</durationType>
+            <Spanner type="Slur">
+              <prev>
+                <location>
+                  <fractions>-1/8</fractions>
+                  </location>
+                </prev>
+              </Spanner>
+            <acciaccatura/>
+            <Note>
+              <eid>kweZpDAtL8N_tPrfS+Op67D</eid>
+              <pitch>74</pitch>
+              <tpc>16</tpc>
+              </Note>
+            </Chord>
+          <Chord>
+            <eid>2Jn0WPS9yjN_myd7yYP+RzC</eid>
+            <BeamMode>no</BeamMode>
+            <durationType>eighth</durationType>
+            <Note>
+              <eid>5DFzE+2mkfJ_dm/dxsKEwDB</eid>
+              <pitch>77</pitch>
+              <tpc>13</tpc>
+              </Note>
+            <Note>
+              <eid>8JEesBITjQM_q3zqabzj3eC</eid>
+              <pitch>81</pitch>
+              <tpc>17</tpc>
+              </Note>
+            </Chord>
+          </voice>
+        </Measure>
+      </Staff>
+    </Score>
+  </museScore>
diff --git a/src/engraving/tests/selectionfilter_tests.cpp b/src/engraving/tests/selectionfilter_tests.cpp
index 551c30b356a01..e6432f20e3995 100644
--- a/src/engraving/tests/selectionfilter_tests.cpp
+++ b/src/engraving/tests/selectionfilter_tests.cpp
@@ -318,7 +318,7 @@ void Engraving_SelectionFilterTests::testNotesInChordsAction(void (*action)(Scor
 }
 
 /**
- * @brief Engraving_VoiceSwitchingTests_notesInChordsDeleteRange
+ * @brief Engraving_SelectionFilterTests_notesInChordsDeleteRange
  * @details See Engraving_SelectionFilterTests::testNotesInChordsAction
  */
 TEST_F(Engraving_SelectionFilterTests, notesInChordsDeleteRange)
@@ -333,7 +333,7 @@ TEST_F(Engraving_SelectionFilterTests, notesInChordsDeleteRange)
 }
 
 /**
- * @brief Engraving_VoiceSwitchingTests_notesInChordsCopyPaste
+ * @brief Engraving_SelectionFilterTests_notesInChordsCopyPaste
  * @details See Engraving_SelectionFilterTests::testNotesInChordsAction
  */
 TEST_F(Engraving_SelectionFilterTests, notesInChordsCopyPaste)
@@ -352,3 +352,76 @@ TEST_F(Engraving_SelectionFilterTests, notesInChordsCopyPaste)
 
     testNotesInChordsAction(copyPasteAction, SELECTIONFILTER_DATA_DIR + String(u"selectionfilter_notesinchords_copypaste-ref.mscx"));
 }
+
+/**
+ * @brief Engraving_VoiceSwitchingTests_gracesAndSlurs
+ * @details Start with a score containing a mixture of grace notes and slurs. Iterate through each measure, modify the selection
+ *          filter, and perform a range delete over that measure. Check the result against the reference.
+ */
+TEST_F(Engraving_SelectionFilterTests, gracesAndSlurs)
+{
+    //! [GIVEN] A score with a grace notes and slurs
+    MasterScore* score = ScoreRW::readScore(SELECTIONFILTER_DATA_DIR + String(u"selectionfilter_gracesandslurs.mscx"));
+    EXPECT_TRUE(score);
+
+    // Clear selection filter...
+    score->selectionFilter().setFiltered(engraving::ElementsSelectionFilterTypes::ALL, false);
+    score->selectionFilter().setFiltered(engraving::NotesInChordSelectionFilterTypes::ALL, false);
+    score->selectionFilter().setIncludeSingleNotes(false);
+
+    // Measure 1
+    //! [WHEN] Performing a delete with nothing filtered...
+    MeasureBase* currentMeasure = score->measure(0);
+    EXPECT_TRUE(currentMeasure);
+    score->deselectAll();
+    score->select(currentMeasure, SelectType::SINGLE);
+
+    score->startCmd(TranslatableString::untranslatable("Selection filter - delete range test"));
+    score->cmdDeleteSelection();
+    score->endCmd();
+
+    // Measure 2
+    //! [WHEN] Performing a delete with graces & slurs filtered...
+    score->selectionFilter().setFiltered(engraving::ElementsSelectionFilterTypes::SLUR, true);
+    score->selectionFilter().setFiltered(engraving::ElementsSelectionFilterTypes::GRACE_NOTE, true);
+
+    currentMeasure = score->measure(1);
+    EXPECT_TRUE(currentMeasure);
+    score->deselectAll();
+    score->select(currentMeasure, SelectType::SINGLE);
+
+    score->startCmd(TranslatableString::untranslatable("Selection filter - delete range test"));
+    score->cmdDeleteSelection();
+    score->endCmd();
+
+    // Measure 3
+    //! [WHEN] Performing a delete with graces only filtered...
+    score->selectionFilter().setFiltered(engraving::ElementsSelectionFilterTypes::SLUR, false);
+
+    currentMeasure = score->measure(2);
+    EXPECT_TRUE(currentMeasure);
+    score->deselectAll();
+    score->select(currentMeasure, SelectType::SINGLE);
+
+    score->startCmd(TranslatableString::untranslatable("Selection filter - delete range test"));
+    score->cmdDeleteSelection();
+    score->endCmd();
+
+    // Measure 4
+    //! [WHEN] Performing a delete with slurs only filtered...
+    score->selectionFilter().setFiltered(engraving::ElementsSelectionFilterTypes::GRACE_NOTE, false);
+    score->selectionFilter().setFiltered(engraving::ElementsSelectionFilterTypes::SLUR, true);
+
+    currentMeasure = score->measure(3);
+    EXPECT_TRUE(currentMeasure);
+    score->deselectAll();
+    score->select(currentMeasure, SelectType::SINGLE);
+
+    score->startCmd(TranslatableString::untranslatable("Selection filter - delete range test"));
+    score->cmdDeleteSelection();
+    score->endCmd();
+
+    //! [EXPECT] The result matches the given reference...
+    EXPECT_TRUE(ScoreComp::saveCompareScore(score, String(u"selectionfilter_gracesandslurs.mscx.mscx"),
+                                            SELECTIONFILTER_DATA_DIR + String("selectionfilter_gracesandslurs-ref.mscx")));
+}